Suppose I want to make additions to a major mode's syntax highlighting, how would I do this without modifying the major mode's source code?

Some ideas:

  • Redefine variable in .emacs
  • Define a minor mode with the changes

Use font-lock-add-keywords. See the Elisp manual, node Customizing Keywords.

The Elisp manual is your friend: C-h i, then choose it. In the manual, i is your friend. E.g., i font-lock TAB.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.