Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我刚刚
(set-face-foreground 'font-lock-comment-face "red") (set-face-foreground 'font-lock-string-face "green")
在我的 .emacs 中,emacs 对 Python 字符串和 Python 文档字符串使用相同的字体锁定。
我应该在我的 .emacs 中添加什么以便区分注释、字符串和文档字符串?
这个答案表明可以这样做。
内置 python.elfont-lock-doc-face通过 python-font-lock-syntactic-face-function 提供。
font-lock-doc-face
python-mode.el 使用font-lock-doc-face,给定py-use-font-lock-doc-face-p的是t。您可以自定义该变量。
py-use-font-lock-doc-face-p
t
用于 doc 字符串的 face 应该是font-lock-doc-face,所以只需自定义它以使其看起来不同。