Håk*_*and 5 emacs elisp font-lock
我正在尝试在 Emacs 中设置一个主要模式,我想在其中突出显示某些关键字。使用此页面中的模板:http://ergoemacs.org/emacs/elisp_syntax_coloring.html我尝试过:
(setq testing-font-lock-keywords
`((font-lock-keyword-face)
))
(define-derived-mode testing-mode fundamental-mode
"testing file mode"
"Major mode for editing test files"
(setq font-lock-defaults '(testing-font-lock-keywords))
(setq mode-name "testing")
)
(provide 'testing-mode)
Run Code Online (Sandbox Code Playgroud)
如果我在一个简单的测试文件上使用此模式,并键入"hello"文本hello以不同的颜色标记。也就是说,双引号内的任何文本都会突出显示。为什么会发生这种情况?
我认为这与变量有关font-lock-keyword-face。但如果我输入C-h v并font-lock-keyword-face显示:
font-lock-keyword-face is a variable defined in `font-lock.el'.
Its value is font-lock-keyword-face
Run Code Online (Sandbox Code Playgroud)
更新
看起来它font-lock-keyword-face无论如何都没有关系,因为定义testing-font-lock-keywords如下:
(setq test-keywords '("TEST"))
(setq testing-font-lock-keywords
`((,test-keywords)))
Run Code Online (Sandbox Code Playgroud)
给出相同的行为。
| 归档时间: |
|
| 查看次数: |
729 次 |
| 最近记录: |