【发布时间】:2020-06-23 12:15:46
【问题描述】:
我想在某些配置文件中突出显示真假值。我有 这样做:
(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)))
但它也突出了 cmets 中的那些值:
有没有办法排除这些突出显示?
UPDATE -- highlight-regexp 是“hi-lock.el”中“hi-lock-face-buffer”的别名。而string-match-p是‘subr.el’中编译的Lisp函数。
【问题讨论】:
-
能否将
highlight-regexp的值添加到问题中? -
另外,添加
string-match-p
标签: regex emacs comments syntax-highlighting