我正在使用Ubuntu 10.04上的emacs 23.1.1。我希望使用2个空格进行Python编程。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个空格缩进。当我尝试C-h 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。我尝试使用customize-group indent,但仍然是4。
我该如何让emacs注意到这个问题?