Hi Tamas, 2015-05-12 10:43 GMT+02:00 Tamas Papp <tkp...@gmail.com>: > Hi, > > I have a setup where I automatically compile a tex file upon saving, but > only if it is a standalone document (eg not something included by > another file): > > (defun LaTeX-in-document-p () > (interactive) > (save-excursion > (goto-char (point-min)) > (search-forward "documentclass" (point-max) t))) > > (defun LaTeX-compile-on-save () > (when (LaTeX-in-document-p) > (TeX-command "LaTeX" 'TeX-master-file))) > > with > > (add-hook 'after-save-hook 'LaTeX-compile-on-save t t) > > executed by LaTeX-mode-hook. > > I am wondering if this setup could be improved with AUCTeX: > > 1. Is there a better way to test for LaTeX-in-document-p? > > 2. If A.tex includes B.tex, is there a way to compile A.tex when saving > B.tex?
If B.tex is included in A.tex and has `TeX-master' correctly set, (TeX-command "LaTeX" 'TeX-master-file) does the right thing, so what's the problem? Bye, Mosè _______________________________________________ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex