[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: font-lock-comment-delimiter-face

From: Stefan Monnier
Subject: Re: font-lock-comment-delimiter-face
Date: Thu, 12 May 2005 23:45:01 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>     For C++ mode, it doesn't quite work:
>        foo // comment1
>        bar /* comment2 */

>     The // and /* are put in font-lock-comment-delimiter-face (which I find to
>     be useless clutter and makes the text less legible without helping
>     understand the structure), but the */ is left with just
>     font-lock-comment-face.

> That is because comment-end is empty in C++ mode.

> I see there is a variable comment-end-skip, whose doc string suggests
> it ought to be useful for this (but the doc string is not entirely
> clear tome).  But it doesn't seem to be set up in C++ mode.  Should it
> be?

Major modes should set comment-end-skip, like they set comment-start-skip,
but since this variable was new in Emacs-21.1 I had to handle the backward
compatible case where a major mode does not set comment-end-skip, so
comment-end-skip is set to an "educated guess" value (based on comment-end
and "\\s>") if not set already.  This defaulting is done by
comment-normalize-vars which is called at the beginning of all major
comment function.

>     I don't understand the above.  In what way does the current code
>     change what font-lock-comment-face looks like?

> When I added font-lock-comment-delimiter-face, I copied the
> definition of font-lock-comment-face into it, then changed
> the definition o font-lock-comment-face.

> It would be cleaner to leave font-lock-comment-face unchanged and
> define font-lock-comment-text-face with the modified value.
> However, I couldn't make that work.  Adapting the code in
> font-lock-fontify-syntactically-region in a straightforward
> way resulted in incorrect results, and I don't know why.

Without seeing the "straightforward way" code, it's hard to tell.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]