Search code examples
emacslatexemacs23

Automatically launch a command with Emacs when it's a .tex file


I want to launch a command when I start emacs with a .tex file. The command is:

M-x flyspell-mode

Is it possible and how?


Solution

  • Perhaps you can add hook to the latex-mode. You can add the following line into your .emacs file.

    (add-hook 'latex-mode-hook 'flyspell-mode)
    

    I didn't test this, however, I think it should work. This will enable flyspell-mode whenever you enter the latex-mode.