[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Regexp search: syntax class for comment starter (\s<) does not work
Re: Regexp search: syntax class for comment starter (\s<) does not work consistently in all modes
Tue, 01 Oct 2019 21:44:14 -0400
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
> by the way, at least in lisp-mode, \s< finds ";"
> inside a string as well).
Indeed, as I said, \s< only denotes those characters which the syntax
tables says "can" start a comment. Whether they do depends on where
> I'm still pretty confused how bat-mode, for example, works as the
> syntax table doesn't contain < syntax.
There is no single char which starts a comment in bat-mode, since the
comment delimiter is composed of 3 characters ("rem") and only in some
places (e.g. "remember" doesn't count as a comment, even though it
starts with "rem").
Syntax-tables can handle 2-char comment delimiters (which covers
languages like C), and for more complex cases such as bat-mode's you
have to use `syntax-propertize-function` as does
`bat--syntax-propertize` to apply a `<` syntax to those `r` characters
which are part of the magic "rem" sequence.
You might like to read the syntax-tables chapter in the Elisp manual.