I want to highlight true and false values in some configuration files. I've done it this way:
(defun my/highlight-in-properties-files ()
"Highlight regexps in PROPERTIES files."
(when (string-match-p ".properties" (file-name-nondirectory buffer-file-name))
(highlight-regexp "true" 'hi-green)
(highlight-regexp "false" 'hi-pink)))
But it also highlight those values in comments:
Is there a way to exclude those highlightings?
UPDATE -- highlight-regexp is an alias for ‘hi-lock-face-buffer’ in ‘hi-lock.el’. And string-match-p is a compiled Lisp function in ‘subr.el’.
