Subject: bug#21832: 11.88.8; prompt for using LuaTeX/XeTeX engine

From: jfbu <[email-masked]>
Date: Wed, 4 Nov 2015 23:30:53 +0100

Hi Mosè

Le 4 nov. 2015 à 23:20, Mosè Giordano <[email-masked]> a écrit :

> Hi Jean-François,
> 
> 2015-11-04 22:47 GMT+01:00 jfbu <[email-masked]>:
>> Remember to cover the basics, that is, what you expected to happen and
>> what in fact did happen.
>> 
>> ------------------------------------------------------------------------
>> 
>> Hi,
>> 
>> steps to reproduce:
>> 
>> create file foo.dtx
>> 
>> \iffalse % meta-comment
>> %<*macos>
>> \documentclass{article}
>> \usepackage{fontspec}
>> \begin{document}
>> \end{document}
>> %</macos>
>> \fi
>> \documentclass{scrdoc}
>> \begin{document}
>> \end{document}
>> 
>> try to run (pdf)latex via C-c C-c
>> 
>> you should see the prompt:
>> 
>>> 
>>> XeTeX, LuaTeX are required to build this document.
>>> Do you want to select one of these engines?
>>> 
>> 
>> as an aside: sometimes the prompt appears in the
>> mini-buffer, sometimes as a pop-up (I use framepop.el)
>> but I have not been able to determine when happens what.
>> 
>> The problem was from a much bigger dtx file, and it
>> has taken me quite some time to reduce it to the mwe above.
>> 
>> The above structure is quite typical of a dtx file
>> which can extract files using docstrip, delimited
>> by guards in the dtx.
>> 
>> In the case at hand, the parsing done by auctex
>> could possibly identify the \iffalse ... \fi
>> but in my actual package.dtx, this is more complicated
>> as I modify catcodes to safely skip hundreds of lines
>> containing themselves conditionals. Thus it is more
>> like ~iffalse...~fi in the source.
>> 
>> The mwe above has given me the idea of another one,
>> which is a foo.tex, not foo.dtx file:
>> 
>> \documentclass{article}
>> 
>> \usepackage{filecontents}
>> 
>> \begin{filecontents}{bar.tex}
>> \documentclass{article}
>> \usepackage{fontspec}
>> \begin{document}
>> \end{document}
>> \end{filecontents}
>> 
>> \begin{document}
>> \end{document}
>> 
>> This will elicit again the
>> 
>>> XeTeX, LuaTeX are required to build this document.
>>> Do you want to select one of these engines?
>>> 
>> 
>> prompt.
>> 
>> It was hard to get these two mwe's (although now it looks
>> obvious) because once we get the prompt we can suppress
>> the entire buffer contents and put anything and we still get
>> it. Even after removing entirely auto/ directory, etc...
>> 
>> One has to kill the buffer and reload it to get rid
>> of the prompt (after having killed the fontspec line)
> 
> Or just set `TeX-check-engine' to nil ;-)
> 
> I don't think can really deal with TeX conditionals, bud I'd like to
> be proven wrong.

I concur that it is impossible to deal with TeX conditionals
in the generality I would need, short of re-implementing 
TeX in lisp. But I would have expected
handling \if... \else \fi with nesting to be much more
feasible, but if you say it's hard, I surely must believe you.

> 
> If the problem is the prompt you can change the value of
> `TeX-check-engine' and this ticket will be closed, if this is a
> request to implement parsing of conditionals we can keep this open,
> even if for me would be "wontfix" or "patches welcome".

It is not a request fo implement parsing of conditionals 
because my second example has no conditionals.

> \documentclass{article}
> 
> \usepackage{filecontents}
> 
> \begin{filecontents}{bar.tex}
> \documentclass{article}
> \usepackage{fontspec}
> \begin{document}
> \end{document}
> \end{filecontents}
> 
> \begin{document}
> \end{document}
> 

Thanks for the pointer to TeX-check-engine

I find it somewhat fragile to decide only on the
basis of having found a \usepackage{fontspec} line
that the engine should be XeTeX or LuaTeX.

This raises maintenance issues on your side as
you must keep an eye on what fontspec will become
in the future, and also on what future engines
might arise etc...

best

Jean-François