emacs-devel
[Top][All Lists]
Advanced

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

Re: Could the current font-lock mechanism support font locking code in c


From: scame
Subject: Re: Could the current font-lock mechanism support font locking code in comments?
Date: Tue, 30 Mar 2021 15:44:55 +0000

>
> `sm-c-mode` does exactly what you describe, except it does it inside
> things the user doesn't think are comments: it sets up the buffer's
> syntax-table such that preprocessor directives are treated a special
> kinds of comments, and then it tells font-lock to apply the usual rules
> inside those "comments".


Sounds good. Though in this case the usual rules don't apply in the sense
that it should use the dimmed version of the same colors, so that commented
code is still visually distinct from uncommented code.

Taking this  example:

// void func () {  }

the comment starter // should have regular comment color and the code
inside should be syntax highlighted with dimmed colors of the regular
faces.

Does this complicate things?


>
> IOW, the problem is just one of recognizing those comments that contain
> code rather than text, which requires some kind of markup.
>

Yes, some kind of markup should be necessary to activate syntax
coloring in those comments.





reply via email to

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