Subject: Re: bug#9148: Make `comment-normalize-vars' more syntax-aware

From: Štěpán Němec <[email-masked]>
Date: Tue, 02 Aug 2011 12:35:03 +0200

On Tue, 02 Aug 2011 06:04:03 +0200
Stefan Monnier wrote:

>> Unfortunately, even though there is a `comment-use-syntax' variable
>> which is apparently supposed to indicate that the comment functions
>> should rely on syntax information instead of `comment-prefix' and
>> friends, one piece is missing -- the function `comment-normalize-vars',
>> called at invocation of functions like {comment,uncomment}-region, still
>> requires `comment-start' to be set explicitly even though the syntax
>> information is sufficient and `comment-use-syntax' set.
>
> I'm not sure I understand the problem.  Can you give a more concrete
> example where you get undesirable behavior?
> Setting comment-start is usually needed to tell Emacs *which* of the
> major mode's comment syntaxes to use (so it's only theoretically
> unneeded if the syntax-table only include a single comment syntax).

The point is that you can define a major mode with different syntax
tables in different parts of the text (using the syntax-table text
property), but instead of using that information to determine
comment-start and the other variables, `comment-normalize-vars' still
relies on `comment-start' being hard-coded (which doesn't really make
sense in a buffer with multiple comment syntaxes), even when
`comment-use-syntax' is set and the syntax-table information is
sufficient.

-- 
Štěpán