相关疑难解决方法(0)

如何将php模式设置从.emacs移动到.dir-locals.el?

这是我的.emacs文件中的内容.

(add-hook 'php-mode-hook
        (lambda ()
        (c-set-style "bsd")
        (setq indent-tabs-mode t)
        (setq c-basic-offset 4)
        (setq tab-width 4)
        (c-set-offset 'arglist-close 'c-lineup-arglist-operators)
        (c-set-offset 'arglist-intro '+)
        (c-set-offset 'arglist-cont-nonempty 'c-lineup-math)
        (c-set-offset 'case-label '+)       
        ))
Run Code Online (Sandbox Code Playgroud)

我想将这些格式设置移动到项目特定目录.虽然我可以轻松地为setq语句(例如(setq indent-tabs-mode t))做到这一点,但我无法为函数调用执行此操作,例如:(c-set-offset 'arglist-intro '+).

这是我放入我的.dir-locals.el的内容:

;;; Directory Local Variables
;;; See Info node `(emacs) Directory Variables' for more information.

    ((php-mode
        (c-set-style "bsd")
        (indent-tabs-mode . t)
        (c-basic-offset . 4)
        (tab-width . 4)
        (c-set-offset 'arglist-close 'c-lineup-arglist-operators)
        (c-set-offset 'arglist-intro 'c-basic-offset)
        (c-set-offset 'arglist-cont-nonempty 'c-lineup-math)
        (c-set-offset 'case-label '+)       
      )) …
Run Code Online (Sandbox Code Playgroud)

emacs

7
推荐指数
1
解决办法
1781
查看次数

emacs中特定于文件的密钥绑定

是否可以在emacs中定义文件特定的键绑定?我想有可能创建一个次要模式,并在特定文件打开时加载它,但只有一个键绑定似乎有点过分.

emacs key-bindings

3
推荐指数
3
解决办法
790
查看次数

标签 统计

emacs ×2

key-bindings ×1