Emacs - how do I automatically enter minor modes when I enter a major mode?

折月煮酒 提交于 2019-12-22 05:17:43

问题


I'm kind of a newb when it comes to emacs. I know about the .emacs file but have very little idea as to do anything more advanced than elementary stuff.

Whenever I enter latex-mode, I'd also like to automatically turn on flyspell-mode, reftex-mode, auto-fill-mode, and also set fill-column to 120. How do I edit my .emacs file to do this?

Thanks!


回答1:


(add-hook 'latex-mode-hook
    (function (lambda ()
       (flymake-mode)
       (reftex-mode)
       (auto-fill-mode)
       (setq fill-column 120))))

for example should work.




回答2:


You can set a so-called hook to a major mode. Have a look at this page of the manual for some examples.



来源:https://stackoverflow.com/questions/4253473/emacs-how-do-i-automatically-enter-minor-modes-when-i-enter-a-major-mode

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