是否可以设置 Emacs 在 Python 模式下显示 Python 代码,在 ReST 模式下显示文档字符串?

是否可以设置 Emacs 在 Python 模式下显示 Python 代码,在 ReST 模式下显示文档字符串?

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

答案1

你可以尝试这个小模式

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)))

相关内容