From 075f832295db891f21ccb0f07696bcaf9e151258 Mon Sep 17 00:00:00 2001 From: paul-loedige Date: Mon, 6 Nov 2023 03:02:04 +0100 Subject: [PATCH] Added compile on save to LaTeX mode --- emacs/.config/doom/config.org | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/emacs/.config/doom/config.org b/emacs/.config/doom/config.org index ef6487e..b909dd8 100644 --- a/emacs/.config/doom/config.org +++ b/emacs/.config/doom/config.org @@ -409,7 +409,16 @@ Enables use of multiple dictionaries. In my case German and English (setq +latex-viewers '(zathura)) #+end_src ** Add auto-compile hook for TeX mode +Because TeX-command-run-all is an interactive command we need a helper function for the hook. +This function could also become useful if we ever want to extend the compile command #+begin_src emacs-lisp :tangle config.el -(add-hook 'tex-mode-hook - (lambda () (add-hook 'after-save-hook 'Tex-command-master))) +(defun custom-tex-compile () + (interactive) + (TeX-command-run-all nil)) + +(add-hook 'TeX-mode-hook + (lambda () + (add-hook 'after-save-hook #'custom-tex-compile nil t))) #+end_src + +#+RESULTS: