Emacs Elisp Overriding Default Value

一笑奈何 提交于 2019-12-12 03:57:09

问题


I have several abbrev defined that I was accessible everywhere except in latex mode. I defined

(setq-default abbrev-mode t)
(add-hook 'latex-mode-hook (lambda () (abbrev-mode -1)))

But whenever I open a latex file it still has abbrev mode enabled. What's going on?


回答1:


Never worked with latex before, but for me the following works fine:

(setq auto-mode-alist (cons '("\\.lat\\'" . latex-mode) auto-mode-alist))
(setq-default abbrev-mode t)
(add-hook 'latex-mode-hook (lambda () (abbrev-mode -1)))

M-x abbrev-mode
%Abbrev mode enabled in current buffer

Please make sure the emacs recognized your file as a latex file, the first line I wrote should do the trick.




回答2:


The reason was that AUCTex uses LaTeX-mode-hook. Thanks to stefan in the comment for pointing that out



来源:https://stackoverflow.com/questions/42324504/emacs-elisp-overriding-default-value

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!