unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: Feature request/RFC: proper highlighting of code embedded in comments
Date: Sun, 16 Oct 2016 13:42:46 -0400	[thread overview]
Message-ID: <jwvvawsry74.fsf-monnier+gmane.emacs.devel@gnu.org> (raw)
In-Reply-To: 930446db-6dad-72a0-d0cd-a0710e5c6ec3@mit.edu

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




  parent reply	other threads:[~2016-10-16 17:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-15 15:19 Feature request/RFC: proper highlighting of code embedded in comments Clément Pit--Claudel
2016-10-15 20:22 ` Dmitry Gutov
2016-10-15 21:21   ` Clément Pit--Claudel
2016-10-16 17:42 ` Stefan Monnier [this message]
2016-10-16 21:05   ` Clément Pit--Claudel
2016-10-17 13:02     ` Stefan Monnier
2016-10-17 14:19       ` Clément Pit--Claudel
2016-10-16 21:10 ` Clément Pit--Claudel
2016-10-17 13:12   ` Stefan Monnier
2016-10-17 14:25     ` Clément Pit--Claudel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvvawsry74.fsf-monnier+gmane.emacs.devel@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).