I use the following function from Latex, Emacs: automatically open * TeX Help * clipboard on error and close it after fixing the error? to compile .tex documents through latexmk
:
(defun run-latexmk () (interactive) (let ((TeX-save-query nil) (TeX-process-asynchronous nil) (master-file (TeX-master-file))) (TeX-save-document "") (TeX-run-TeX "latexmk" (TeX-command-expand "latexmk -pdf %s" 'TeX-master-file); adjusted master-file) (if (plist-get TeX-error-report-switches (intern master-file)) (TeX-next-error t) (progn (demolish-tex-help) (minibuffer-message "latexmk: Done")))))
How can I “add” this function to TeX-command-list
so that this function is executed by Cc Cc
in .tex files? [ Cc Cc
should use run-latexmk
by default when executed in .tex files]
I tried
(add-hook 'LaTeX-mode-hook (lambda () (add-to-list 'TeX-command-list '("latexmk" #'run-latexmk TeX-run-command nil t :help "Run latexmk") t) (setq TeX-command-default "latexmk")))
but it does not work with the message: TeX-command-expand: Wrong type argument: stringp, (function run-latexmk)
(taken from * Messages *)
source share