I'm using AUCTeX and I would like to bind a key, e.g. C-0
, that does the following:
- Saves the active file without prompting me.
- Runs
latexmk
on the active file without prompting me. - Shows me errors if
latexmk
encounters any by .
My problem is not how to bind a key (for which Tyler posted a link in a comment below) but how to come up with a function that accomplishes item 1–3.
I call Latexmk by
(add-hook 'LaTeX-mode-hook (lambda ()
(push
'("Latexmk" "latexmk %s" TeX-run-TeX nil t
:help "Run Latexmk on file")
TeX-command-list)))
This is my .latexmkrc
$pdf_mode = 1;
$recorder = 1;
$latex = 'latex -recorder -halt-on-error -interaction=nonstopmode -shell-escape';
$pdflatex = 'pdflatex -recorder -halt-on-error -interaction=nonstopmode -shell-escape';
I'm using Emacs 23.3 and AUCTeX 11.86.
C-c C-c
should compile your tex file with latexmk (you may have to alter the config files to get latexmk to popup as your default, but AucTex usually knows what to do). The actual command that's run isTeX-command-master
, which you can bind using the usual approach: masteringemacs.org/articles/2011/02/08/… – PazpazaC-c C-c
still prompts me even if it's the default. – Steib