I sometimes use Makefiles with LaTeX documents, and so I'd like to define a command that does something similar to AUCTeX's C-c C-a
(TeX-command-run-all
) but using make
.
I tried creating a function that calls both "Make" and "View", as suggested for Arara in this answer, but the "View" command never seems to be executed. I see a message that says "Compilation finished", but then the viewer does not open. Here's what I have in my init.el
file:
(use-package tex
:ensure auctex
:mode ("\\.tex\\'" . TeX-latex-mode)
:config
(setq TeX-view-program-list '(("PDF Tools" TeX-pdf-tools-sync-view)))
(setq TeX-view-program-selection '((output-pdf "PDF Tools")))
(add-hook 'TeX-after-compilation-finished-functions
#'TeX-revert-document-buffer)
(add-to-list
'TeX-command-list
'("Make"
"make"
TeX-run-compile
nil
t
:help "Run make"))
(defun adamliter-TeX-make ()
"Interactive function for running GNU Make on a (La)TeX file."
(interactive)
(TeX-command-sequence '("Make" "View") t))
:bind
(:map TeX-mode-map
("C-c C-m" . adamliter-TeX-make)))
Moreover, how do I ensure that the document buffer is reverted? I have basically the same setup for Arara based on the linked answer, but when I run adamliter-TeX-arara
, the document buffer does not seem to revert, despite having added TeX-revert-document-buffer
to the hook TeX-after-compilation-finished-functions
. Is this hook not run when commands are invoked via TeX-command-sequence
?