How to distinguish python strings and docstrings in emacs buffer?

If I only have

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

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

Python-comments-strings-and-docstrings

What should I add to my .emac so that comments, lines and docstrings stand out?

This answer suggests that this is possible.

+1
python emacs font-lock
source share
2 answers

The built-in python.el provides font-lock-doc-face through the python-font-lock-syntactic-face-function function.

python-mode.el uses font-lock-doc-face , given py-use-font-lock-doc-face-p - t . You can configure this variable.

0
source share

The face used for doc strings should be font-lock-doc-face , so just tweak it to look different.

0
source share

All Articles