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: Stefan Monnier
Subject: Re: Could the current font-lock mechanism support font locking code in comments?
Date: Tue, 30 Mar 2021 10:06:05 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Could current font lock support this somehow or there
> is no way that the same buffer part can be fontified
> two times by such competing rules?

`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".

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


        Stefan




reply via email to

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