我在 Ubuntu 10.04 上使用 emacs 23.1.1。我希望在 Python 中使用 2 个空格缩进进行编程。emacs 看起来有 python 的默认模式(python.el?)。
我将以下内容放入我的 .emacs 中:
;; Only spaces, no tabs
(setq indent-tabs-mode nil)
;; Always end a file with a newline
(setq require-final-newline nil)
;; Don't know which of these might work
(setq-default tab-width 2)
(setq-default python-indent 2)
(setq-default py-indent-offset 2)
当我编辑 Python 文件时,它使用 4 个空格缩进。当我尝试 Ch v python-indent 它说:
python-indent's value is 4
Local in buffer webpage_cache.py; global value is 2
This variable is safe as a file local variable if its value
satisfies the predicate `integerp'.
Documentation:
Number of columns for a unit of indentation in Python mode.
See also `M-x python-guess-indent'
You can customize this variable.
也就是说,它是 4,而不是 2。我尝试自定义变量并保存,仍然是 4。我尝试自定义组缩进,仍然是 4。
如何让emacs关注?