Michael R. Head (suppressingfire) wrote,
Michael R. Head

Recompile-on-save in Emacs

From time to time, I find myself trying to remember how to get Emacs to automatically recompile (or re-run pdflatex or whatever) each time I save a file. This isn't something to put in a .emacs file because most of the time this isn't desirable, but when writing or coding, it's nice not to have to think about re-running the build.

So once I've started work, and have run my first compilation with M-x compile, I pop open the *scratch* buffer and type this:

(add-hook 'after-save-hook 'recompile)

and follow it up with C-x C-e.

Tags: emacs, latex
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded