tom-tan / auctex-latexmk

This library adds LatexMk support to AUCTeX.
92 stars 24 forks source link

Drop auctex-latexmk with your own configs tips (replace `TeX-run-TeX` with `TeX-run-format`) #47

Open tshu-w opened 1 year ago

tshu-w commented 1 year ago

I'm dropping auctex-latexmk from my configuration as it's not maintained. According to this report, we can replace TeX-run-TeX with TeX-run-format to avoid using the complex Latexmk-sentinel:

  (add-to-list 'TeX-expand-list
               '("%(-PDF)"
                 (lambda ()
                   (if TeX-PDF-mode
                       (cond
                        ((eq TeX-engine 'default) "-pdf")
                        ((eq TeX-engine 'xetex) "-pdfxe")
                        ((eq TeX-engine 'luatex) "-pdflua")) ""))))
  (add-to-list 'TeX-command-list
               '("LaTeXmk" "latexmk %(-PDF) -%(PDF)%(latex)='%`%l%(mode)%'' %(output-dir) %t"
                 TeX-run-format nil (latex-mode doctex-mode) :help "Run Latexmk"))
  (with-eval-after-load 'latex
    (setq LaTeX-clean-intermediate-suffixes
          (append LaTeX-clean-intermediate-suffixes '("\\.fdb_latexmk" "\\.fls"))))
titanofold commented 9 months ago

In addition to what @tshu-w contributed, I've added a hook to set LaTeKmk as the default. When LaTeX-mode is invoked for each file/buffer, it overrides the user's prior setq declaration, so the hook is needed to actually align with the user's preference.

(add-hook 'LaTeX-mode-hook (lambda () (setq TeX-command-default "LaTeXmk")))

Stolen from: https://www.reddit.com/r/emacs/comments/vl38v0/comment/idv0ips/?utm_source=share&utm_medium=web2x&context=3