Ads by Google

Monday, May 30, 2011

AucTeX Tip: Automatically save file before compiling

It used to be irritating for me that I had to save the file when I hit C-C C-C when compiling the file.  It tends to break my flow of work when I had to hit 'y' when Emacs queries me to save the file before compiling.

No  more.

Asking on the Auctex mailing list, the answer turned out to be a simple
(setq TeX-save-query nil) ;;autosave before compiling

customisation to my .emacs file.
It saves me a few keystrokes of C-x C-s too in the event I forget to regularly save my file.  Hopefully, this is worth it for you too.

4 comments:

Andi Albrecht said...

Thanks for sharing this quite simple tip! This question breaks my workflow too. But I wasn't annoyed enough (yet) to ask on the mailing list :)

Marcin said...

Thanks a lot - .emacs edited;).

Oscar said...

I use this to make my life even easier:

(defun my-tex-mode-hook ()
(local-set-key (kbd "") (kbd "C-c C-c C-j")))
(add-hook 'TeX-mode-hook 'my-tex-mode-hook)

Edmundo said...

Really helpful, thanks. Love the emacs community cooperation, its one of the main reason I stick with emacs.