(re-search-forward "\\s<") won't find comments
that begin with a 2 character comment starter.
For example:
(modify-syntax-entry ?\{ "<" st)
(modify-syntax-entry ?\} ">" st)
(modify-syntax-entry ?\= "_ b12" st)
(modify-syntax-entry ?\n "> b" st)
^ <- with point here (re-search-forward "\\s<")
some text ==followed by comment
more text {different style comment}
The {dif... line will be found, not the ==foll... line.
I noticed it when the following function didn't always work.
Being generic, it has no way of knowing what comment
characters are defined for the current mode and currently
can't depend on the character syntax either.
(defun end-of-code-or-line ()
"Move to EOL. If there, to EOL sans comments."
(interactive)
(if (not (eolp))
(end-of-line)
(skip-syntax-backward " \t")
(let ((pt (point))
(lim (line-beginning-position)))
(when (re-search-backward "\\s<" lim t)
(setq lim (point))
(if (re-search-forward "\\s>" (1- pt) t)
(goto-char pt)
(goto-char lim) ; test here ->
(while (looking-back "\\s<")
(backward-char))
(skip-syntax-backward " \t"))))))
Richard Bielawski
612-667-5039
_______________________________________________
Emacs-pretest-bug mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug