我想为C和python文件独立配置Emacs空白选项,因为缩进突出显示(制表符前的空格等)不适用于python编码风格。我目前全局设置了空白变量,但希望为Python单独(最小)配置。以下是我的.emacs的相关部分:
(require 'whitespace)
(setq whitespace-line-column 80)
(setq whitespace-style '(face lines-tail indentation trailing space-before-tab))
(add-hook 'c-mode-hook 'whitespace-mode)
这适用于c。最好是Python的'(face lines-tail trailing),但我不知道如何为特定模式设置。正确的做法是什么?谢谢。在Ubuntu中使用Emacs 23
我通过将设置放入钩子中并调用whitspace -mode:
(add-hook 'python-mode-hook
(lambda ()
(progn
(setq whitespace-line-column 79)
(setq whitespace-style '(face lines-tail))
(whitespace-mode))))
也许使用文件局部变量可以帮助您?