From: Emanuel Berg <incal@dataswamp.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Using face names as FACESPEC in font-lock-keywords does not work
Date: Wed, 22 Jun 2022 22:42:34 +0200 [thread overview]
Message-ID: <877d58o2f9.fsf@dataswamp.org> (raw)
In-Reply-To: a7bf9753bf3dd458136b3d5b59c32449@posteo.de
jan.synacek wrote:
> I have the following piece of code that is supposed to add
> highlighting for CPP-like conditionals in my mode:
>
> (setq-local font-lock-defaults
> (let* ((cpp-rx (rx line-start
> "#" (or "if" "ifdef" "else"
> "elif" "endif")
That's not C++ ... or what is it, the preprocessor?
> word-boundary))
> (keywords
> `((,cpp-rx . xref-file-header))))
> (list keywords)))
>
> This piece of code does not work and does not use the
> 'xref-file-header' face.
>
> In the Elisp manual (24.6.2 Search-based Fontification) it
> says [...] In the simplest case [...]
Did you make it work "in the simplest case"?
Do that, so you know it works _at all_, if it does you can add
complexity all day every day.
I made it work two times:
https://dataswamp.org/~incal/emacs-init/gnus/browse.el (simple)
https://dataswamp.org/~incal/emacs-init/buffer-menu.el (???)
They work, 100% is all I'll say.
--
underground experts united
https://dataswamp.org/~incal
next prev parent reply other threads:[~2022-06-22 20:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-22 8:33 Using face names as FACESPEC in font-lock-keywords does not work jan.synacek
2022-06-22 20:42 ` Emanuel Berg [this message]
2022-06-22 20:46 ` Emanuel Berg
2022-06-23 5:36 ` Eli Zaretskii
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=877d58o2f9.fsf@dataswamp.org \
--to=incal@dataswamp.org \
--cc=help-gnu-emacs@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.
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).