Search forward first regexp not inside a comment.

  • Download Gist
re-search-forward-not-in-comment.el
Emacs Lisp
1 2 3 4 5
(defun re-search-forward-not-in-comment (regexp)
"Search forward first regexp not inside a comment. "
(interactive
(list (read-from-minibuffer "Regexp: ")))
(while (and (re-search-forward regexp nil t 1)(or (and (nth 8 (syntax-ppss))(nth 3 (syntax-ppss)))(and (nth 8 (syntax-ppss))(nth 4 (syntax-ppss)))))))

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.