Emacs - how can I automatically enter small modes when I enter main mode?

I'm kind of new when it comes to emacs. I know about the .emacs file, but I have very little idea to do something more advanced than elementary.

Whenever I enter latex mode, I would also like to automatically enable flyspell, reftex-mode, auto-fill-mode, and also set fill-column to 120. How do I change the .emacs file to do this?

Thanks!

+6
emacs latex
source share
2 answers
(add-hook 'latex-mode-hook (function (lambda () (flymake-mode) (reftex-mode) (auto-fill-mode) (setq fill-column 120)))) 

for example, should work.

+10
source share

You can set the so-called "hook" in the main mode. Check out this manual page for some examples.

+2
source share

All Articles