Emacs 可以设置为在 Python 模式下显示 Python 代码并在 ReST 模式下显示文档字符串吗?

Tho*_*sen 5 python emacs restructuredtext

我经常在 Emacs 中编辑 Python 代码,并将其设置为以 Python 模式显示 Python 文件。我经常发现自己将文档字符串格式化为 ReStructured Text 并且我想如果我可以让 Emacs 像在 ReST 模式下一样显示这些文档字符串会很棒。这有可能吗?

小智 4

你可以试试这个小模式

https://github.com/glyph/python-docstring-mode

有了这个配置:

(add-to-list 'load-path "/path/to/python-docstring-mode-master")
(require 'python-docstring)
(add-hook 'python-mode-hook (lambda () (python-docstring-mode t)))
Run Code Online (Sandbox Code Playgroud)