I want to run Latexmk automatically with the correct TeX-engine as set in the local file variable at the end of the file, for example:
%% Local Variables: %% TeX-engine: luatex %% End:
.emacs file I tried something like:
(add-hook 'LaTeX-mode-hook (lambda () (push '("Latexmk" "latexmk %(-PDF) %s" TeX-run-TeX nil t :help "Run Latexmk on file") TeX-command-list) '("%(-PDF)" (lambda () (if (equal TeX-engine 'luatex) "-lualatex" "-pdf"))))
but it doesn't work.
So how can I get the desired result?