emacs-devel
[Top][All Lists]
Advanced

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

Re: Feature request/RFC: proper highlighting of code embedded in comment


From: Stefan Monnier
Subject: Re: Feature request/RFC: proper highlighting of code embedded in comments
Date: Sun, 16 Oct 2016 13:42:46 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux)

FWIW, in sm-c-mode.el (in elpa.git), CPP directives are treated as
comments, and since they do contain code, I have to solve the same kind
of problem.

I (ab)use for that purpose a syntactic face function.  The starting
point is:

  (setq-local font-lock-syntactic-face-function #'sm-c-syntactic-face-function)

Take a look at sm-c-syntactic-face-function and especially
sm-c--cpp-fontify-syntactically to see how I try to re-use the existing
font-lock functionality.

It's a bit gross, tho.


        Stefan




reply via email to

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