问题
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