我在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空间缩进。当我尝试C-h v python缩进时,它会说:
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。Grr号。我试着自定义变量并保存,仍然是4。我试着自定义组缩进,还是4。
如何让emacs注意?