I found that I needed to wrap it in (eval-after-load "tex" '(progn

And that it still didn't seem to detect the correct engine.

I came up with:

(eval-after-load "tex"
  '(progn
     (add-to-list 'TeX-expand-list
                  '("%(-PDF)"
                    (lambda ()
                      (if (string-match "TeX-engine: luatex" (buffer-string))
                          "-pdflatex=lualatex -pdf" "-pdf"))))
     
     (add-to-list 'TeX-command-list
                  '("Latexmk" "latexmk %(-PDF) -synctex=1 %s"
                    TeX-run-TeX nil t
                    :help "Run Latexmk on file to build everything."))

     (setq TeX-command-default "Latexmk")
     ))

Which works for my purposes (correctly uses the lualatex engine when I
have %%% TeX-engine: luatex in my headers, and otherwise uses the
pdflatex engine --- though it should probably be
expanded to handle xetex and "plain" dvi generation.


> Date: Wed, 24 Oct 2012 22:07:28 +0200
> From: Ivan Andrus <[email protected]>
> To: Benjamin Slade <[email protected]>
> Cc: [email protected]
> Subject: Re: [AUCTeX] auctex Digest, Vol 92, Issue 16
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=us-ascii
>
> Oops.  Sorry, that's from my .emacs:
>
> (defun alist-set (alist-symbol key value &optional search-cdr)
>   "e.g. (alist-set 'interpreter-mode-alist 'perl-mode 'cperl-mode t)"
>   (let ((cons-cell (if search-cdr
>                        (rassoc key (symbol-value alist-symbol))
>                      (assoc key (symbol-value alist-symbol)))))
>     (if cons-cell
>         (if search-cdr
>             (setcar cons-cell key)
>           (setcdr cons-cell value))
>       (set alist-symbol (cons (cons key value)
>                               (symbol-value alist-symbol))))))
>
> However, it's probably just easier to use add-to-list if you
> don't need to overwrite values.  Namely:
>
>     (add-to-list 'TeX-expand-list
>                  '("%(-PDF)"
>                    (lambda ()
>                      (if (and (not TeX-Omega-mode)
>                               (or TeX-PDF-mode TeX-DVI-via-PDFTeX))
>                          "-pdf" "-dvi"))))
>
>     (add-to-list 'TeX-command-list
>                  '("Latexmk" "latexmk %(-PDF) %s"
>                    TeX-run-TeX nil t
>                    :help "Run Latexmk on file to build everything."))
>
> -Ivan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{sent by mu4e on Emacs running under GNU/Linux}

_______________________________________________
auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex

Reply via email to