如何区分一个emacs缓冲区中的Python字符串和docstrings? [英] How to distinguish Python strings and docstrings in an emacs buffer?

查看:161
本文介绍了如何区分一个emacs缓冲区中的Python字符串和docstrings?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我只是

(set-face-foreground 'font-lock-comment-face "red")
(set-face-foreground 'font-lock-string-face "green")

在我的.emacs中,emacs对Python字符串和Python文本字符串使用相同的字体锁。

in my .emacs, emacs uses the same font-lock for Python strings and for Python docstrings.

我应该添加到我的.emacs,以便注释,字符串和文献资料有区别?

What should I add to my .emacs so that comments, strings, and docstrings are distinguished?

这个回答表明可以这样做。

This answer suggests that it is possible to do so.

推荐答案

内置python.el提供 font-lock-doc-face 通过python-font-lock-syntax-face-function。

Built-in python.el provides font-lock-doc-face via python-font-lock-syntactic-face-function.

python-mode.el使用 font-lock-doc-face ,给定 py-use-font-lock-doc-face-p t 。您可以自定义该变量。

python-mode.el uses font-lock-doc-face, given py-use-font-lock-doc-face-p is t. You can customize that variable.

这篇关于如何区分一个emacs缓冲区中的Python字符串和docstrings?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆