Subject: Re: bug#70817: 14.0.3.2024-03-17; max-lisp-eval-depth exceeded with XeTeX option

From: Arash Esbati <[email-masked]>
Date: Wed, 08 May 2024 12:45:58 +0200

Hi Florian,

"Landis Florian (ladi)" <[email-masked]> writes:

> You're right, AUCTeX loads the file just fine if emacs is started with 
> the -Q switch.

Just to be sure, the recipe is to save the file on your HD:

--8<---------------cut here---------------start------------->8---
\documentclass{article}

\title{Minimal working example}
\author{Florian}
\begin{document}
\maketitle

\begin{document}

\section{What happens}

This does not load AUCTeX correctly with the XeTeX commented option at
the end of the document, but works fine without it.  With the option,
Emacs says that 'max-lisp-eval-depth' is exceeded and commands for
compiling the document under AUCTeX are not available.

Leaving out below option and doing 'M-x TeX-engine-set RET xetex'
produces no hiccups.

\end{document}

%%% Local Variables:
%%% mode: LaTeX
%%% TeX-master: t
%%% TeX-engine: xetex
%%% coding: utf-8
%%% End:
--8<---------------cut here---------------end--------------->8---

And then:

• Uninstall AUCTeX with 'M-x package-delete RET auctex RET'
• Restart Emacs and install AUCTeX via the package interface
• Start Emacs with "emacs -Q"
• In scratch, eval the following:
    (progn
      (package-initialize t)
      (package-activate 'auctex))
• Open the .tex file above
• See if it works
• Also do 'M-x list-load-path-shadows RET' and check what it tells

> Does that mean that there's something else in my configuration of
> Emacs (or AUCTeX?) that is tripping AUCTeX up?

Yes, that might be one conclusion.

> I wouldn't even know where to start looking...

The first step is described above: If it works in a clean environment,
we can proceed; and you might get help here from others :-)

> In the meantime, the solution that works for me is to reduce the local 
> variable list to:
>
> %%% Local Variables:
> %%% TeX-engine: xetex
> %%% coding: utf-8
> %%% End:
>
> I think the line
>
> %%% mode: latex
>
> is the culprit in my case. Was there an infinite loop between AUCTeX 
> loading latex-mode automatically and again due to the local variables?

I depends, it might be that you've loaded the built-in latex-mode.  So
again, please follow the recipe above and tell us what you get.

Best, Arash