1

For example, I want to use font-lock-add-keywords highlight some keywords in source code. But the font lock system would also highlight the same words (anywhere) in the comments/docs/strings part of the source file.

Since there are functions that detects the environment of a given position, e.g. python-info-docstring-p, my question is that is it possible to use these kind of functions to have conditional font lock highlights?

Thanks in advance.

  • 1
    "the font lock system would also highlight the same words (anywhere) in the comments/docs/strings" - No it wouldn't, unless you set OVERRIDE in the highlighter (see (elisp) Search-based Fontification). – npostavs Mar 25 '17 at 13:40

Your Answer

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

Browse other questions tagged or ask your own question.