help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Using face names as FACESPEC in font-lock-keywords does not work


From: Emanuel Berg
Subject: Re: Using face names as FACESPEC in font-lock-keywords does not work
Date: Wed, 22 Jun 2022 22:42:34 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

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




reply via email to

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