Nordlöw
Nordlöw

Reputation: 12138

Modifying Font-Locking Entries in Emacs

How do I make change to XXX-font-lock-keywords (typically using assoc plus setcdr) affect the fontification in XXX-mode? It doesn't suffice to simply change the variable to make the change have effect.

Upvotes: 0

Views: 233

Answers (2)

Lindydancer
Lindydancer

Reputation: 26094

The best way, as a normal user, to modify font-lock entries is to use the function font-lock-add-keywords and font-lock-remove-keywords. For example:

(font-lock-add-keywords c-mode
             '(("\\<\\(FIXME\\):" 1
                font-lock-warning-face t)))

Upvotes: 2

jtahlborn
jtahlborn

Reputation: 53684

EmacsWiki is a great source for emacs knowledge, such as this.

Upvotes: 0

Related Questions