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

2015-11-05 Thread Mosè Giordano
Hi Jean-François,

2015-11-05 10:15 GMT+01:00 jfbu :
> Hi Mosè
>
> Le 5 nov. 2015 à 00:01, Mosè Giordano  a écrit :
>>
>> fontspec requires two engines, we can't select one of the two for the
>> user.  The point is that compilation will certainly fail if one loads
>> particular packages, provided that there aren't conditionals.  A
>> prompt suggesting you the action to take is better than waiting for
>> the compilation to finish and then try to realize what went wrong.
>
>
> sorry to possibly sound very stubborn:
>
>
> one does not have to wait (except perhaps in batchmode, but that's
> not interactive) for compilation to finish, as package fontspec
> itself very prominently complains if it is run under pdftex rather
> than xetex/luatex.
>
> the compilation halts immediately (in my experience)
>
> ERROR: Fatal fontspec error: "cannot-use-pdftex"
>
> --- TeX said ---
> !
> ! The fontspec package requires either XeTeX or LuaTeX to function.
> !
> ! You must change your typesetting engine to, e.g., "xelatex" or "lualatex"
> ! instead of plain "latex" or "pdflatex".
> !
> ! See the fontspec documentation for further information.
> !
> ! For immediate help type H .
> !...

Ok, but you have to run compilation, wait that second to finish, read
the log and add the `TeX-engine' variable (and if you insert the
variable by hand you have also to revert the buffer in order for the
change to take effect).  The prompt skips directly to the setting of
`TeX-engine'.

> and I now realize that this alternative MWE:
>
> \documentclass{article}
>
> \usepackage{ifxetex}
>
> \ifxetex
> \usepackage{fontspec}
> \else
> \usepackage[utf8]{inputenc}
> \usepackage[T1]{fontenc}
> \fi
>
> \begin{document}
> \end{document}
>
> suffices to elicit the prompting. I guess this is what you
> meant by detecting conditionals.

Yes.

> When was that behavior introduced ? I had no issues with files
> like the above in the past.

Around three months ago.

>>
>>>
>>> Why not rather a file variable at top of file ? Yes, user will
>>> have thus to put something explicit there, but isn't it actually
>>> better if the file is destined to be exchanged with other people
>>> possibly not using Emacs/AUCTeX ?
>>
>> We already have a file-local variable to specify the engine to use,
>> `TeX-engine', the check is only for those who forget to set it
>> properly.
>
>
> I myself proposed file local variable in the citation above but
> should have thought better. File local variable is not so good
> an idea, because ideally a TeX source should not be tied to an engine.

How do you propose to tell AUCTeX which compiler/engine to run?  It
doesn't have a mind-reading system, yet ;-)  It's not to tie a
document to an engine, it's about how to tell your editor what to do.
Local variables aren't carved into the rock, you can change them.

> Who knows if 20 years from now there will still be XeTeX ? (at one
> point a few years back, support for XeTeX on Mac OS was on the decline
> due to issues I don't know nor understand about font libraries, although
> initially XeTeX first was developed for Mac OS).
>
> If I want my source to be valid years from now, the best is to
> have some comment at top saying: "Compile this preferably with XeTeX"
> Only if XeTeX primitives are used making it XeTeX-only would
> a file-local variable possibly be justified.
>
> Presence of fontspec by itself only currently reduces to two engines.
> It does not reduce to only one engine. I remain of the opinion
> that parsing the source for \usepackage{fontspec} and on this
> basis issue the prompting is not really an advance in AUCTeX's
> ergonomy.
>
> Naturally that's only a personal opinion ;-) But there must be
> people who maintain multiple-engine-compatible sources
> (in the past, some like me went to some efforts to allow
> both latex+dvips and pdflatex, and I still do that almost systematically
> now for latex+dvipdfmx viz. pdflatex, using conditionals
> to help hyperref, xcolor, etc... get the correct driver if
> latex+dvipdfmx road is followed)
> and the prompting will be a bit annoying to them...

These conditionals often go into a package, in a hand-written style
file we can do something like

(if (member TeX-engine '(xetex luatex))
(TeX-run-style-hooks "fontspec"))

so that there won't be any problem for the user.

> ... TeX-check-engine set to nil appears a necessity then,
>
> To conclude, my personal opinion is this should be the default, with the
> documentation mentioning that the user may customize
> it instead to t, to get the prompting behavior if it fits his/her bill.

AUCTeX's parser is known to fail when there are conditionals, you just
discovered one of such cases.  I'd like to keep this feature on by
default to receive more feedback (if it's off by default not many
people would try it), if more complaints will come I can think about
changing the default behavior.

Bye,
Mosè




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

2015-11-05 Thread jfbu

Le 5 nov. 2015 à 10:15, jfbu  a écrit :

> the compilation halts immediately (in my experience)
> 
> ERROR: Fatal fontspec error: "cannot-use-pdftex"
> 
> --- TeX said ---
> ! 
> ! The fontspec package requires either XeTeX or LuaTeX to function.
> ! 
> ! You must change your typesetting engine to, e.g., "xelatex" or "lualatex"
> ! instead of plain "latex" or "pdflatex".
> ! 
> ! See the fontspec documentation for further information.
> ! 
> ! For immediate help type H .
> !...  
> 

forgot the important part in the log:

l.43  }
   
|'''
| This is a fatal error: LaTeX will abort.
|...



best,

Jean-François


___
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex


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

2015-11-05 Thread jfbu

Le 5 nov. 2015 à 10:38, Mosè Giordano  a écrit :

> if more complaints will come I can think about
> changing the default behavior.

I promise not to bribe anyone to emit "dis-like"'s
on AUCTeX's facebook/twitter accounts ;-)

(whatever that means, because I stay safely
light-years away from these so-called social
networks)

bye,
Jean-François


___
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex



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

2015-11-04 Thread jfbu
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}
%
\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)

I noticed the issue with a package of mine. I now realize
something has changed in auctex because a Septembre 2013
version of package.dtx now also shows the issue, and I most
definitely did not encounter it back then,

actually I don't think this problem
was showing up with the September 12, 2015 version of
package.dtx, but I forgot when exactly I saw it for the first time.

Best,

Jean-François



Emacs  : GNU Emacs 24.5.7 (x86_64-apple-darwin13.4.0, Carbon Version 157 AppKit 
1265.21)
 of 2015-09-28 on Atago.local
Package: 11.88.8

current state:
==
(setq
 AUCTeX-date "2015-08-28"
 window-system 'mac
 LaTeX-version "2e"
 TeX-style-path '("~/.emacs.d/auctex"
  "/Users/xxx/.emacs.d/elpa/auctex-11.88.8/style"
  "/Users/xxx/.emacs.d/auctex/auto"
  "/Users/xxx/.emacs.d/auctex/style" "auto" "style")
 TeX-auto-save t
 TeX-parse-self t
 TeX-master t
 TeX-command-list '(("TeX"
 "%(PDF)%(tex) %(extraopts) %`%S%(PDFout)%(mode)%' %t"
 TeX-run-TeX nil
 (plain-tex-mode texinfo-mode ams-tex-mode) :help
 "Run plain TeX")
("LaTeX" "%`%l%(mode)%' %t" TeX-run-TeX nil
 (latex-mode doctex-mode) :help "Run LaTeX")
 [...]
 )




___
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex


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

2015-11-04 Thread Mosè Giordano
Hi Jean-François,

2015-11-04 22:47 GMT+01:00 jfbu :
> 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}
> %
> \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.

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".

Bye,
Mosè



___
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex


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

2015-11-04 Thread jfbu

Le 04/11/2015 23:37, Mosè Giordano a écrit :

close 21832
tags 21832 notabug
thanks


2015-11-04 23:30 GMT+01:00 jfbu :

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.


Do you have other suggestions?  They're welcome :-)


I don't at this time ... I was surprised by the prompt
for XeTeX/LuaTeX (which in my use case was wrong, but
certainly that was very specific context), and if I had
to pause to think about it, I would be tempted by the somewhat
provocative but sincere feeling that checking for the
engine is not that of a good idea. It would perhaps
if only *one* engine was proposed as candidate, but if one has
to choose between luatex and xetex, that's not much
speed gain compared to doing it beforehand, or
being confronted with a botched pdflatex compilation and
doing it then.

Recently I read a bit of XeTeX doc, and it is perfectly
possible to use it without fontspec package.

I find it a bit surprising to tie discovery of XeTeX/LuateX
to use of fontspec package.

Why not rather a file variable at top of file ? Yes, user will
have thus to put something explicit there, but isn't it actually
better if the file is destined to be exchanged with other people
possibly not using Emacs/AUCTeX ?





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...


Well, in style/ directory we have 196 files that raise lots of
maintenance issues, so we are used to them ;-)  We do our best to keep
them updated, and we seek for other people helping us.



My defense is now going to become pathetic, but this is time to
reveal that in my practice of auctex I surely underuse by a
factor 1000 the goodies which might come from whatever is in
style/

I must examine that



I'm closing this ticket.



ok
bye,
Jean-François




___
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex


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

2015-11-04 Thread Mosè Giordano
close 21832
tags 21832 notabug
thanks


2015-11-04 23:30 GMT+01:00 jfbu :
> 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.

Do you have other suggestions?  They're welcome :-)

> 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...

Well, in style/ directory we have 196 files that raise lots of
maintenance issues, so we are used to them ;-)  We do our best to keep
them updated, and we seek for other people helping us.

I'm closing this ticket.

Bye,
Mosè



___
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex


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

2015-11-04 Thread Mosè Giordano
2015-11-04 23:50 GMT+01:00 jfbu :
>> Do you have other suggestions?  They're welcome :-)
>
>
> I don't at this time ... I was surprised by the prompt
> for XeTeX/LuaTeX (which in my use case was wrong, but
> certainly that was very specific context), and if I had
> to pause to think about it, I would be tempted by the somewhat
> provocative but sincere feeling that checking for the
> engine is not that of a good idea. It would perhaps
> if only *one* engine was proposed as candidate

fontspec requires two engines, we can't select one of the two for the
user.  The point is that compilation will certainly fail if one loads
particular packages, provided that there aren't conditionals.  A
prompt suggesting you the action to take is better than waiting for
the compilation to finish and then try to realize what went wrong.

> but if one has
> to choose between luatex and xetex, that's not much
> speed gain compared to doing it beforehand, or
> being confronted with a botched pdflatex compilation and
> doing it then.
>
> Recently I read a bit of XeTeX doc, and it is perfectly
> possible to use it without fontspec package.

Indeed the problem is the other way round: you can't use fontspec
without {Xe,Lua}TeX.

> I find it a bit surprising to tie discovery of XeTeX/LuateX
> to use of fontspec package.
>
> Why not rather a file variable at top of file ? Yes, user will
> have thus to put something explicit there, but isn't it actually
> better if the file is destined to be exchanged with other people
> possibly not using Emacs/AUCTeX ?

We already have a file-local variable to specify the engine to use,
`TeX-engine', the check is only for those who forget to set it
properly.

Cheers,
Mosè



___
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex