The problem is that AUCTeX will use this kind of call:
Running `TeX' on `testfmt' with ``xetex -file-line-error --synctex=1 -interaction=nonstopmode "\input" testfmt.tex''
Due to the \input
a first line %&foo
to use foo.fmt
format file is ignored, for example with this file:
%&foo
\foo
\bye
% Local variables:
% TeX-engine: xetex;
% End:
where macro \foo
was defined in the dumped foo.fmt
.
You can see it originates in "%'"
in TeX-expand-list-builtin
and its usage in TeX-command-list
("TeX" "%(PDF)%(tex) %(file-line-error) %(extraopts) %`%S%(PDFout)%(mode)%' %t" TeX-run-TeX nil
(plain-tex-mode ams-tex-mode texinfo-mode)
:help "Run plain TeX")
I have customized the variable to contain this other entry
("texfmt" "%(PDF)%(tex) %(file-line-error) %(extraopts) %S%(PDFout)%(mode) %t" TeX-run-TeX nil
(plain-tex-mode)
:help "Fait (xe|lua|pdf)tex")
The only difference is I removed the %'
. edit: I also removed the %`
whose elisp definition makes it look like it is to be used paired with %'
but this would need confirmation by AUCTeX people.
Then when I open a buffer with file above I see in the menu "Command" a new entry texfmt
. I choose that and xetex is run and uses the foo.fmt
.
Running `texfmt' on `testfmt' with ``xetex -file-line-error -interaction=nonstopmode testfmt.tex''
This is XeTeX, Version 3.14159265-2.6-0.99999 (TeX Live 2018) (preloaded format=foo)
restricted \write18 enabled.
entering extended mode
(./testfmt.tex [1] )
Output written on testfmt.pdf (1 page).
Transcript written on testfmt.log.
TeX Output finished at Thu Apr 19 00:11:19
À propos formats with xelatex, not xetex, see this for a difficulty.