【问题标题】:Configure C whitespace and Python whitspace independently in Emacs在 Emacs 中独立配置 C 空白和 Python 空白
【发布时间】:2011-11-01 17:06:01
【问题描述】:

我想为 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 使用 '(facelines-tail trailing),但我不知道如何仅为特定模式设置 q。这样做的正确方法是什么?谢谢。在 Ubuntu 中使用 Emacs 23。

【问题讨论】:

    标签: emacs whitespace highlight


    【解决方案1】:

    我通过将设置放入钩子以及调用空白模式来使其工作:

    (add-hook 'python-mode-hook
              (lambda ()
                (progn
                  (setq whitespace-line-column 79)
                  (setq whitespace-style '(face lines-tail))
                  (whitespace-mode))))
    

    【讨论】:

      【解决方案2】:

      也许使用File Local Variables 可以帮助你?

      【讨论】:

        猜你喜欢
        • 2012-07-11
        • 1970-01-01
        • 1970-01-01
        • 2011-05-25
        • 1970-01-01
        • 2012-12-27
        • 2016-02-10
        • 1970-01-01
        • 2013-05-18
        相关资源
        最近更新 更多