GNU bug report logs -
#9148
Make `comment-normalize-vars' more syntax-aware
Previous Next
Reported by: Štěpán Němec <stepnem <at> gmail.com>
Date: Fri, 22 Jul 2011 14:57:02 UTC
Severity: wishlist
Tags: moreinfo
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Problem:
--------
Emacs currently provides relatively decent support for major modes with
multiple syntaxes, mainly via the `syntax-table' text property.
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.
Suggested solution:
-------------------
Modify `comment-normalize-vars' so that it uses the syntax information
(current syntax table, `syntax-table' text property) _only_, whenever
`comment-use-syntax' is set and this is possible.
Use case:
---------
Consider a major mode with two or more clearly separate syntaxes (Org
mode source blocks could be one example), including comments.
Even though it is possible to provide the different text extents with
different values of the `syntax-table' text property, the only way to
work around `comment-normalize-vars' not relying on them currently seems
something like the following:
(defadvice comment-normalize-vars (around use-syntax-info activate)
(set (make-local-variable 'comment-start)
(determine-comment-start-based-on-syntax-info))
ad-do-it)
...which is evil, ugly and doesn't scale.
--
Štěpán
This bug report was last modified 3 years and 192 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.