[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX] test if buffer is a standalone document
From: |
Tamas Papp |
Subject: |
[AUCTeX] test if buffer is a standalone document |
Date: |
Tue, 12 May 2015 10:43:13 +0200 |
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?
Best,
Tamas
- [AUCTeX] test if buffer is a standalone document,
Tamas Papp <=