Discussion:
[AUCTeX] overlay prompting
jfbu
2016-01-15 09:32:41 UTC
Permalink
Hi,

I am starting noticing that 11.89 now by default
asks for Overlay spec when creating a new \item
in a list. This is a Beamer thing I guess.

1. this prompting is there by default, is this
reasonable ? (just asking ;-) )

2. how can I turn this off ? I don't regularly
use beamer.sty.

best,

Jean-François
jfbu
2016-01-15 09:36:08 UTC
Permalink
Le 15/01/2016 10:32, jfbu a écrit :
> Hi,
>
> I am starting noticing that 11.89 now by default
> asks for Overlay spec when creating a new \item
> in a list. This is a Beamer thing I guess.
>
> 1. this prompting is there by default, is this
> reasonable ? (just asking ;-) )
>
> 2. how can I turn this off ? I don't regularly
> use beamer.sty.
>
> best,
>
> Jean-François

ah well. It is not there by default, it seems. Should
have tested sorry.

But it is there
in a document of mine which does not use beamer at all
but does mention Beamer at some locations, don't know
how that ends up confusing auctex.

best
Jean-François
Mosè Giordano
2016-01-15 09:38:56 UTC
Permalink
Hi Jean-François,

2016-01-15 10:36 GMT+01:00 jfbu <***@free.fr>:
> Le 15/01/2016 10:32, jfbu a écrit :
>>
>> Hi,
>>
>> I am starting noticing that 11.89 now by default
>> asks for Overlay spec when creating a new \item
>> in a list. This is a Beamer thing I guess.
>>
>> 1. this prompting is there by default, is this
>> reasonable ? (just asking ;-) )
>>
>> 2. how can I turn this off ? I don't regularly
>> use beamer.sty.
>>
>> best,
>>
>> Jean-François
>
>
> ah well. It is not there by default, it seems. Should
> have tested sorry.
>
> But it is there
> in a document of mine which does not use beamer at all
> but does mention Beamer at some locations, don't know
> how that ends up confusing auctex.

It would be useful to see how beamer is mentioned. Only something like

\documentclass{...]{beamer}
\usepackage{beamer}

outside a verbatim environment would load beamer style file. BTW, the
second is wrong but unfortunately AUCTeX doesn't distinguish between
classes and packages.

Bye,
Mosè
jfbu
2016-01-15 09:42:39 UTC
Permalink
Le 15/01/2016 10:38, Mosè Giordano a écrit :
> Hi Jean-François,
>
> 2016-01-15 10:36 GMT+01:00 jfbu <***@free.fr>:
>> Le 15/01/2016 10:32, jfbu a écrit :
>>>
>>> Hi,
>>>
>>> I am starting noticing that 11.89 now by default
>>> asks for Overlay spec when creating a new \item
>>> in a list. This is a Beamer thing I guess.
>>>
>>> 1. this prompting is there by default, is this
>>> reasonable ? (just asking ;-) )
>>>
>>> 2. how can I turn this off ? I don't regularly
>>> use beamer.sty.
>>>
>>> best,
>>>
>>> Jean-François
>>
>>
>> ah well. It is not there by default, it seems. Should
>> have tested sorry.
>>
>> But it is there
>> in a document of mine which does not use beamer at all
>> but does mention Beamer at some locations, don't know
>> how that ends up confusing auctex.
>
> It would be useful to see how beamer is mentioned. Only something like
>
> \documentclass{...]{beamer}
> \usepackage{beamer}
>
> outside a verbatim environment would load beamer style file. BTW, the
> second is wrong but unfortunately AUCTeX doesn't distinguish between
> classes and packages.
>
> Bye,
> Mosè
>

I am trying to pinpoint the problem, but it is a bit complicated.

So far I have only identified that \usepackage{enumitem} triggers
(Optional) Options (k=v): but I can't reproduce the Overlay prompting yet

(and I was in the middle of things; I should have waited for more
appropriate time)

bye
Jean-François
jfbu
2016-01-15 09:57:44 UTC
Permalink
Le 15/01/2016 10:42, jfbu a écrit :
> Le 15/01/2016 10:38, Mosè Giordano a écrit :
>> Hi Jean-François,
>>
>> 2016-01-15 10:36 GMT+01:00 jfbu <***@free.fr>:
>>> Le 15/01/2016 10:32, jfbu a écrit :
>>>>
>>>> Hi,
>>>>
>>>> I am starting noticing that 11.89 now by default
>>>> asks for Overlay spec when creating a new \item
>>>> in a list. This is a Beamer thing I guess.
>>>>
>>>> 1. this prompting is there by default, is this
>>>> reasonable ? (just asking ;-) )
>>>>
>>>> 2. how can I turn this off ? I don't regularly
>>>> use beamer.sty.
>>>>
>>>> best,
>>>>
>>>> Jean-François
>>>
>>>
>>> ah well. It is not there by default, it seems. Should
>>> have tested sorry.
>>>
>>> But it is there
>>> in a document of mine which does not use beamer at all
>>> but does mention Beamer at some locations, don't know
>>> how that ends up confusing auctex.
>>
>> It would be useful to see how beamer is mentioned. Only something like
>>
>> \documentclass{...]{beamer}
>> \usepackage{beamer}
>>
>> outside a verbatim environment would load beamer style file. BTW, the
>> second is wrong but unfortunately AUCTeX doesn't distinguish between
>> classes and packages.
>>
>> Bye,
>> Mosè
>>
>
> I am trying to pinpoint the problem, but it is a bit complicated.
>
> So far I have only identified that \usepackage{enumitem} triggers
> (Optional) Options (k=v): but I can't reproduce the Overlay prompting yet
>
> (and I was in the middle of things; I should have waited for more
> appropriate time)
>
> bye
> Jean-François
>
>

Mosè, the problem is that I could reproduce once the problem keeping
the same preamble from my document,

but not after moving the test file to another repertory, quit and
relaunch emacs.

worse: now the problem which *did* show up with test file in its
original locationdoes not anymore.

It still shows in the original big file.

Sorry: there is an issue, but it is just too much time consuming for me
now to investigate. Because I don't know if the repertory contents can
influence it etc...

Aside: this is the same big file which creates always a wrong prompting
for luatex/xetex compilation.

Best,

Jean-François
jfbu
2016-01-24 09:38:42 UTC
Permalink
Le 15 janv. 2016 à 10:57, jfbu <***@free.fr> a écrit :

> Le 15/01/2016 10:42, jfbu a écrit :
>> Le 15/01/2016 10:38, Mosè Giordano a écrit :
>>> Hi Jean-François,
>>>
>>> 2016-01-15 10:36 GMT+01:00 jfbu <***@free.fr>:
>>>> Le 15/01/2016 10:32, jfbu a écrit :
>>>>>
>>>>> Hi,
>>>>>
>>>>> I am starting noticing that 11.89 now by default
>>>>> asks for Overlay spec when creating a new \item
>>>>> in a list. This is a Beamer thing I guess.
>>>>>
>>>>> 1. this prompting is there by default, is this
>>>>> reasonable ? (just asking ;-) )
>>>>>
>>>>> 2. how can I turn this off ? I don't regularly
>>>>> use beamer.sty.
>>>>>
>>>>> best,
>>>>>
>>>>> Jean-François
>>>>
>>>>
>>>> ah well. It is not there by default, it seems. Should
>>>> have tested sorry.
>>>>
>>>> But it is there
>>>> in a document of mine which does not use beamer at all
>>>> but does mention Beamer at some locations, don't know
>>>> how that ends up confusing auctex.
>>>
>>> It would be useful to see how beamer is mentioned. Only something like
>>>
>>> \documentclass{...]{beamer}
>>> \usepackage{beamer}
>>>
>>> outside a verbatim environment would load beamer style file. BTW, the
>>> second is wrong but unfortunately AUCTeX doesn't distinguish between
>>> classes and packages.
>>>
>>> Bye,
>>> Mosè
>>>
>>
>> I am trying to pinpoint the problem, but it is a bit complicated.


Hi Mosè,

Sorry for the delay. It was a very big file, with complicated
non-typical structure (thousands of lines before \documentclass),
and I should have focused on where "beamer" actually appeared in
the file, but did not have the time back then.

Your message seems to imply that the
following is unexpected:

% file testauctexparse.tex
\documentclass{article}
\begin{document}
% insert thousands of lines if you wish
\begin{verbatim}
\documentclass{beamer}
\end{verbatim}
\end{document}

Steps to reproduce:

1. create the above file with extension .tex.

2. Try C-cC-e and the default environment is "frame"

3. Try an itemize environment and an Overlay spec will be ask for.

4. The following testauctexparse.el file appears in auto/:
(possibly after an extra C-xC-s)

(TeX-add-style-hook
"testauctexparse"
(lambda ()
(add-to-list 'LaTeX-verbatim-environments-local "semiverbatim")
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperref")
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperimage")
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperbaseurl")
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "nolinkurl")
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "url")
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "path")
(add-to-list 'LaTeX-verbatim-macros-with-delims-local "url")
(add-to-list 'LaTeX-verbatim-macros-with-delims-local "path")
(TeX-run-style-hooks
"latex2e"
"article"
"art10"
"beamer"
"beamer10")))

I am with:
Emacs : GNU Emacs 24.5.8 (x86_64-apple-darwin13.4.0, Carbon Version 157 AppKit 1265.21)
of 2015-10-31 on Atago.local
Package: 11.89

current state:
==============
(setq
AUCTeX-date "2015-11-13"
window-system 'mac
LaTeX-version "2e"
TeX-style-path '("~/.emacs.d/auctex"
"/Users/xxxxxx/.emacs.d/elpa/auctex-11.89/style"
"/Users/xxxxxx/.emacs.d/auctex/auto"
"/Users/xxxxxx/.emacs.d/auctex/style" "auto" "style")
TeX-auto-save t
TeX-parse-self t
TeX-master t
[....]
)

Best,

Jean-François
Mosè Giordano
2016-01-24 14:14:50 UTC
Permalink
Hi Jean-François,

2016-01-24 10:38 GMT+01:00 jfbu <***@free.fr>:
> Sorry for the delay. It was a very big file, with complicated
> non-typical structure (thousands of lines before \documentclass),
> and I should have focused on where "beamer" actually appeared in
> the file, but did not have the time back then.
>
> Your message seems to imply that the
> following is unexpected:
>
> % file testauctexparse.tex
> \documentclass{article}
> \begin{document}
> % insert thousands of lines if you wish
> \begin{verbatim}
> \documentclass{beamer}
> \end{verbatim}
> \end{document}
>
> Steps to reproduce:
>
> 1. create the above file with extension .tex.
>
> 2. Try C-cC-e and the default environment is "frame"
>
> 3. Try an itemize environment and an Overlay spec will be ask for.
>
> 4. The following testauctexparse.el file appears in auto/:
> (possibly after an extra C-xC-s)
>
> (TeX-add-style-hook
> "testauctexparse"
> (lambda ()
> (add-to-list 'LaTeX-verbatim-environments-local "semiverbatim")
> (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperref")
> (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperimage")
> (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperbaseurl")
> (add-to-list 'LaTeX-verbatim-macros-with-braces-local "nolinkurl")
> (add-to-list 'LaTeX-verbatim-macros-with-braces-local "url")
> (add-to-list 'LaTeX-verbatim-macros-with-braces-local "path")
> (add-to-list 'LaTeX-verbatim-macros-with-delims-local "url")
> (add-to-list 'LaTeX-verbatim-macros-with-delims-local "path")
> (TeX-run-style-hooks
> "latex2e"
> "article"
> "art10"
> "beamer"
> "beamer10")))

I was almost sure that code in verbatim environment was ignored during
parsing, but I was completely wrong. Reading the code, there is no
such test and I think it's so for performance reasons. The obvious
fix would be to do said test, but I fear parsing time would increase
sensibly. I should do some tests.

For your specific problem, you can redefine
`TeX-arg-beamer-overlay-spec' function to do nothing, at least while
you work on that document.

Bye,
Mosè
Mosè Giordano
2016-01-24 14:25:31 UTC
Permalink
2016-01-24 15:19 GMT+01:00 jfbu <***@free.fr>:
> Thanks for the tip. Could the parsing possibly decide not to take
> into account a second `\documentclass` ?

I'm not sure this is feasible. If I remember well, I once proposed to
do have a parsing for preamble stuff (\documentclass, \usepackage,
\newcommand, etc), and another for document body, but it should have
been rejected.

Another option is to set `TeX-auto-parse-length' to a value less than
the position of that \documentclass, but nothing else would be parsed
after the value of the variable, not just the \documentclass.

Bye,
Mosè
jfbu
2016-01-24 14:28:56 UTC
Permalink
Le 24 janv. 2016 à 15:25, Mosè Giordano <***@gnu.org> a écrit :

> 2016-01-24 15:19 GMT+01:00 jfbu <***@free.fr>:
>> Thanks for the tip. Could the parsing possibly decide not to take
>> into account a second `\documentclass` ?
>
> I'm not sure this is feasible. If I remember well, I once proposed to
> do have a parsing for preamble stuff (\documentclass, \usepackage,
> \newcommand, etc), and another for document body, but it should have
> been rejected.
>
> Another option is to set `TeX-auto-parse-length' to a value less than
> the position of that \documentclass, but nothing else would be parsed
> after the value of the variable, not just the \documentclass.


I also forgot that in my big document there are 4 \documentclass
before the correct one (as the document is a dtx with portions
to get extracted to separate files). And the correct one is on
line 1196.

The \documentclass{beamer} arises on line 1890.

So if you set `TeX-auto-parse-length' to some value about 1500,
that will fix it for me ;;;---)

Jean-François
Joost Kremers
2016-01-24 21:00:57 UTC
Permalink
On Sun, Jan 24 2016, jfbu <***@free.fr> wrote:
> The \documentclass{beamer} arises on line 1890.
>
> So if you set `TeX-auto-parse-length' to some value about 1500,
> that will fix it for me ;;;---)

Can't you put a ZERO WIDTH NO-BREAK SPACE (U+FEFF) in the
\documentclass{beamer} line inside the verbatim environment? That should
be enough to throw off the parser but it won't show in the pdf.

--
Joost Kremers
Life has its moments
jfbu
2016-01-25 09:08:06 UTC
Permalink
Le 24/01/2016 22:00, Joost Kremers a écrit :
>
> On Sun, Jan 24 2016, jfbu <***@free.fr> wrote:
>> The \documentclass{beamer} arises on line 1890.
>>
>> So if you set `TeX-auto-parse-length' to some value about 1500,
>> that will fix it for me ;;;---)
>
> Can't you put a ZERO WIDTH NO-BREAK SPACE (U+FEFF) in the
> \documentclass{beamer} line inside the verbatim environment? That should
> be enough to throw off the parser but it won't show in the pdf.
>

ok, good idea thanks, but I have a constraint that for some reasons
my document must use an 8bit source encoding, and also for some other
(additional) reasons I must use latex, not xelatex or lualatex.

nevertheless let me briefly report on trying your idea:

With the initial test file:

\documentclass{article}
\begin{document}
\begin{verbatim}
\documentclass{beamer}
\end{verbatim}
\end{document}

1) an U+FEFF inserted before the closing brace does not fool the
parser

2) an U+FEFF inserted between document and class does trick the
parser on C-xC-s but has the aftereffect that if I do C-cC-n
then AUCTeX mistakenly switches the buffer to AMSTeX mode (plain tex).

3) with the U+FEFF between "doc" and "ument", things are _OK_.

I can then compile the source above with xelatex/lualatex. But,
trying with pdflatex and the modified source (I have the U+FEFF there)

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}
% insert thousands of lines if you wish
\begin{verbatim}
\documentclass{beamer}
\end{verbatim}

\end{document}

I get

ERROR: Package inputenc Error: Unicode char  (U+FEFF)

--- TeX said ---
(inputenc) not set up for use with LaTeX.

Some extra work would thus be needed. Anyhow I mentioned already that
in my use case, my source must be 8bit encoded.

And, for maintenance I need to be able to copy-paste easily from
my source these code snippets for testing, and using such an
(almost) invisible character is not very convenient.

I can do something inspired by your idea. My source is latin1 encoded.
I could devote some character in the 128-255 range for that task,
a character not in use elsewhere.

For example:

% -*- coding: iso-latin-1; -*-
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\let¡\empty
\begin{document}

\begin{verbatim}
\doc¡umentclass{beamer}
\end{verbatim}

\end{document}

This works. Testing for maintenance of the document that the code snippet
from the verbatim is OK is made a bit more complicated as I will
have to remove the ¡, but at least it is obvious what I should do.

My document has other AUCTeX-parsing related problems. For example

\begin{verbatim}
\usepackage{fontspec}
\end{verbatim}

similarly triggers AUCTeX to prompt me for xetex/luatex compilation.
This made the workflow a bit painful, but I forgot about it last time
as I was doing latex runs via a Makefile.

I could use the ¡ trick here, but I also have \usepackage{fontspec}
in other locations: within (sort of) \iffalse...\fi blocks, for
docstrip file extractions from the dtx source. Having a ¡ in there
means something extra has to be added:

\input docstrip.tex
\catcode`\¡ 9

works, but with the extra complication that this itself also has to
be extracted from the .dtx source, to be put inside an .ins file,
hence if ¡ is "ignored" during that extraction the ins file will end
up with \catcode`\ 9. But that's a detail.

I could do some massive search/replace now for \documentclass/\usepackage
occurrences, but 1) I hope not to have to work on the document for quite
some time, and 2) it is a bit annoying to modify sources only for matters
of an Editor; as these sources are then distributed, I would
thereby make them less usable to third parties.

Also, perhaps commands like \setmainfont also make AUCTeX's parser react,
or is it only \documentclass and \usepackage ?

Best,

Jean-François
Mosè Giordano
2016-01-25 20:21:09 UTC
Permalink
Hi Jean-François,

2016-01-25 10:08 GMT+01:00 jfbu <***@free.fr>:
> My document has other AUCTeX-parsing related problems. For example
>
> \begin{verbatim}
> \usepackage{fontspec}
> \end{verbatim}
>
> similarly triggers AUCTeX to prompt me for xetex/luatex compilation.
> This made the workflow a bit painful, but I forgot about it last time
> as I was doing latex runs via a Makefile.

(setq TeX-check-engine nil)

makes the warning go away.

> Also, perhaps commands like \setmainfont also make AUCTeX's parser react,
> or is it only \documentclass and \usepackage ?

\setmainfont isn't parsed.

Bye,
Mosè
jfbu
2016-01-25 21:45:25 UTC
Permalink
Hi Mosè,

Le 25/01/2016 21:21, Mosè Giordano a écrit :
> Hi Jean-François,
>
> 2016-01-25 10:08 GMT+01:00 jfbu <***@free.fr>:
>> My document has other AUCTeX-parsing related problems. For example
>>
>> \begin{verbatim}
>> \usepackage{fontspec}
>> \end{verbatim}
>>
>> similarly triggers AUCTeX to prompt me for xetex/luatex compilation.
>> This made the workflow a bit painful, but I forgot about it last time
>> as I was doing latex runs via a Makefile.
>
> (setq TeX-check-engine nil)
>
> makes the warning go away.

ah yes, actually you already told me so in the fontspec thread,
thanks for reminding me

>
>> Also, perhaps commands like \setmainfont also make AUCTeX's parser react,
>> or is it only \documentclass and \usepackage ?
>
> \setmainfont isn't parsed.

ok, then perhaps I will do the ¡ trick after all.

Rather than \let¡\empty, I could also simply do \catcode`\¡ 9
to tell TeX/LaTeX to ignore it rather than have it be active
(which it is via \usepackage[latin1]{inputenc}) with an empty
expansion

best regards,

Jean-François
jfbu
2016-01-25 21:48:11 UTC
Permalink
Hi Mosè,

Le 25/01/2016 21:21, Mosè Giordano a écrit :
> Hi Jean-François,
>
> 2016-01-25 10:08 GMT+01:00 jfbu <***@free.fr>:
>> My document has other AUCTeX-parsing related problems. For example
>>
>> \begin{verbatim}
>> \usepackage{fontspec}
>> \end{verbatim}
>>
>> similarly triggers AUCTeX to prompt me for xetex/luatex compilation.
>> This made the workflow a bit painful, but I forgot about it last time
>> as I was doing latex runs via a Makefile.
>
> (setq TeX-check-engine nil)
>
> makes the warning go away.

ah yes, actually you already told me so in the fontspec thread,
thanks for reminding me

>
>> Also, perhaps commands like \setmainfont also make AUCTeX's parser react,
>> or is it only \documentclass and \usepackage ?
>
> \setmainfont isn't parsed.

ok, then perhaps I will do the ¡ trick after all.

Rather than \let¡\empty, I could also simply do \catcode`\¡ 9
to tell TeX/LaTeX to ignore it rather than have it be active
(which it is via \usepackage[latin1]{inputenc}) with an empty
expansion

best regards,

Jean-François
[sorry for possibly posting twice, had a problem with my news reader]
jfbu
2016-01-25 21:45:40 UTC
Permalink
Hi Mosè,

Le 25/01/2016 21:21, Mosè Giordano a écrit :
> Hi Jean-François,
>
> 2016-01-25 10:08 GMT+01:00 jfbu <***@free.fr>:
>> My document has other AUCTeX-parsing related problems. For example
>>
>> \begin{verbatim}
>> \usepackage{fontspec}
>> \end{verbatim}
>>
>> similarly triggers AUCTeX to prompt me for xetex/luatex compilation.
>> This made the workflow a bit painful, but I forgot about it last time
>> as I was doing latex runs via a Makefile.
>
> (setq TeX-check-engine nil)
>
> makes the warning go away.

ah yes, actually you already told me so in the fontspec thread,
thanks for reminding me

>
>> Also, perhaps commands like \setmainfont also make AUCTeX's parser react,
>> or is it only \documentclass and \usepackage ?
>
> \setmainfont isn't parsed.

ok, then perhaps I will do the ¡ trick after all.

Rather than \let¡\empty, I could also simply do \catcode`\¡ 9
to tell TeX/LaTeX to ignore it rather than have it be active
(which it is via \usepackage[latin1]{inputenc}) with an empty
expansion

best regards,

Jean-François
Vincent Belaïche
2016-02-29 22:38:05 UTC
Permalink
Salut Jean-François,

Not tested idea :

Can't you fool the parser by writing \^^64ocumentclass instead of \documentclass when you are inside the verbatim env.

I guess that the ^^64 is parsed by TeX input processor, so it is not sensitive to verbatim catcodification. Am I wrong ?

   Vincent.

----------------------------------------
> To: ***@gnu.org
> From: ***@free.fr
> Date: Mon, 25 Jan 2016 22:45:40 +0100
> Subject: Re: [AUCTeX] overlay prompting
>
> Hi Mosè,
>
> Le 25/01/2016 21:21, Mosè Giordano a écrit :
>> Hi Jean-François,
>>
>> 2016-01-25 10:08 GMT+01:00 jfbu <***@free.fr>:
>>> My document has other AUCTeX-parsing related problems. For example
>>>
>>> \begin{verbatim}
>>> \usepackage{fontspec}
>>> \end{verbatim}
>>>
>>> similarly triggers AUCTeX to prompt me for xetex/luatex compilation.
>>> This made the workflow a bit painful, but I forgot about it last time
>>> as I was doing latex runs via a Makefile.
>>
>> (setq TeX-check-engine nil)
>>
>> makes the warning go away.
>
> ah yes, actually you already told me so in the fontspec thread,
> thanks for reminding me
>
>>
>>> Also, perhaps commands like \setmainfont also make AUCTeX's parser react,
>>> or is it only \documentclass and \usepackage ?
>>
>> \setmainfont isn't parsed.
>
> ok, then perhaps I will do the ¡ trick after all.
>
> Rather than \let¡\empty, I could also simply do \catcode`\¡ 9
> to tell TeX/LaTeX to ignore it rather than have it be active
> (which it is via \usepackage[latin1]{inputenc}) with an empty
> expansion
>
> best regards,
>
> Jean-François
>
>
> _______________________________________________
> auctex mailing list
> ***@gnu.org
> https://lists.gnu.org/mailman/listinfo/auctex
jfbu
2016-03-01 07:10:20 UTC
Permalink
Bonjour Vincent

let's take a risk and reply without testing either ;-)

I trust the \^^64ocumentclass will fool the AUCTeX parser (it should ;-) )
but the problem is that within a verbatim the ^ is sanitized to catcode 12.
Thus the latex run will actually print verbatim ^^64.

The ^^ input form needs ^ to be of catcode 7.

It actually works with any catcode 7 character (I used this in the source
of a package). For example && if you do \catcode`& 7.

But & is also sanitized by verbatim:

~$ latexdef dospecials

\dospecials:
macro:->\do \ \do \\\do \{\do \}\do \$\do \&\do \#\do \^\do \_\do \%\do \~

and besides, I may need it to naturally for tabulars.

Thus this approach would need at least the same amount of preparation
as the technique of \doc¡umentclass which I adopted near the end of the
thread (which works using \catcode`\¡ 9 ).

Best, Jean-François

Le 29 févr. 2016 à 23:38, Vincent Belaïche <***@hotmail.fr> a écrit :

> Salut Jean-François,
>
> Not tested idea :
>
> Can't you fool the parser by writing \^^64ocumentclass instead of \documentclass when you are inside the verbatim env.
>
> I guess that the ^^64 is parsed by TeX input processor, so it is not sensitive to verbatim catcodification. Am I wrong ?
>
> Vincent.
>
> ----------------------------------------
>> To: ***@gnu.org
>> From: ***@free.fr
>> Date: Mon, 25 Jan 2016 22:45:40 +0100
>> Subject: Re: [AUCTeX] overlay prompting
>>
>> Hi Mosè,
>>
>> Le 25/01/2016 21:21, Mosè Giordano a écrit :
>>> Hi Jean-François,
>>>
>>> 2016-01-25 10:08 GMT+01:00 jfbu <***@free.fr>:
>>>> My document has other AUCTeX-parsing related problems. For example
>>>>
>>>> \begin{verbatim}
>>>> \usepackage{fontspec}
>>>> \end{verbatim}
>>>>
>>>> similarly triggers AUCTeX to prompt me for xetex/luatex compilation.
>>>> This made the workflow a bit painful, but I forgot about it last time
>>>> as I was doing latex runs via a Makefile.
>>>
>>> (setq TeX-check-engine nil)
>>>
>>> makes the warning go away.
>>
>> ah yes, actually you already told me so in the fontspec thread,
>> thanks for reminding me
>>
>>>
>>>> Also, perhaps commands like \setmainfont also make AUCTeX's parser react,
>>>> or is it only \documentclass and \usepackage ?
>>>
>>> \setmainfont isn't parsed.
>>
>> ok, then perhaps I will do the ¡ trick after all.
>>
>> Rather than \let¡\empty, I could also simply do \catcode`\¡ 9
>> to tell TeX/LaTeX to ignore it rather than have it be active
>> (which it is via \usepackage[latin1]{inputenc}) with an empty
>> expansion
>>
>> best regards,
>>
>> Jean-François
>>
>>
>> _______________________________________________
>> auctex mailing list
>> ***@gnu.org
>> https://lists.gnu.org/mailman/listinfo/auctex
>
Vincent Belaïche
2016-03-01 19:55:03 UTC
Permalink
Ok I see. I made some test, and character ÷ (obélus in French) is invisible in verbatim without any preparation provided that you are using OT1 font encoding. See:

\documentclass{minimal}
\usepackage[OT1]{fontenc}
\begin{document}
\verb+\÷documentclass+
\end{document}


Well, it would be nice if there was some character different from \ btu for which font encoding generate the same glyph as \, then you could use this character in the verbatim in place of \, in order to foul the AUCTeX parser...

One more idea to fool the parser : place all the verbatim stuff into a separate file and load it with verbatim input (http://www.tex.ac.uk/FAQ-verbfile.html). You could also place the verbatim stuff into some file my-stuff.tex, then process it by some script that verbatimize all the special characters (e.g. replace \ by \textbackslash) into some other file my-stuff-verb.tex, and then \input my-stuff-verb.tex (you would need a Makefile to do that).

Not sure whether this was already said during the discussion, for your information you can disable automatic parse (info "(auctex) Parsing Files") by setting to nil TeX-parse-self and TeX-auto-save in file local way, so some local AUCTeX patch only on your machine would be not too annoying --- it is acceptable to wait for the 3s once and for all, or every time you press C-c C-n, the problem is waiting so much on C-x C-s.

One more idea on the AUCTeX front is as follows: the (verbatim-p) in Mosè's patch could be made conditional on some new variable TeX-parse-strict-p defaulting to nil, so the patch would (edited by hand from Mosè's patch, not tested) :

--- a/tex.el
+++ b/tex.el
@@ -4065,7 +4065,8 @@ you should not use something like `[\\(]' for a
character range."
(match-beginning (car b))))))
(symbol (nth 2 entry))
(match (nth 1 entry)))
- (unless (TeX-in-comment)
+ (unless (or (TeX-in-comment)
+ (and TeX-parse-strict-p (TeX-verbatim-p)))
(looking-at (nth 0 entry))
(if (fboundp symbol)
(funcall symbol match)
So you would just make file-locally TeX-parse-strict-p true, and both TeX-auto-save TeX-parse-self false.

One more idea is the following : my speculation is that AUCTeX is slow because when you do (verbatim-p) or something like that in the code patch you will regexp search backward and forward, so if S is the size of the file to scan, you need to scan over potentially S^2 characters instead of S because of the secondary search. Maybe it would be possible to make the code more efficient by scanning for \begin and \end commands at the same time as \documentclass and \usepackage, placing the search result into some variable and then using the search results to make it all.

   Vincent.

----------------------------------------
> Subject: Re: [AUCTeX] overlay prompting
> From: ***@free.fr
> Date: Tue, 1 Mar 2016 08:10:20 +0100
> CC: ***@gnu.org
> To: ***@hotmail.fr
>
> Bonjour Vincent
>
> let's take a risk and reply without testing either ;-)
>
> I trust the \^^64ocumentclass will fool the AUCTeX parser (it should ;-) )
> but the problem is that within a verbatim the ^ is sanitized to catcode 12.
> Thus the latex run will actually print verbatim ^^64.
>
> The ^^ input form needs ^ to be of catcode 7.
>
> It actually works with any catcode 7 character (I used this in the source
> of a package). For example && if you do \catcode`& 7.
>
> But & is also sanitized by verbatim:
>
> ~$ latexdef dospecials
>
> \dospecials:
> macro:->\do \ \do \\\do \{\do \}\do \$\do \&\do \#\do \^\do \_\do \%\do \~
>
> and besides, I may need it to naturally for tabulars.
>
> Thus this approach would need at least the same amount of preparation
> as the technique of \doc¡umentclass which I adopted near the end of the
> thread (which works using \catcode`\¡ 9 ).
>
> Best, Jean-François
>
> Le 29 févr. 2016 à 23:38, Vincent Belaïche <***@hotmail.fr> a écrit :
>
>> Salut Jean-François,
>>
>> Not tested idea :
>>
>> Can't you fool the parser by writing \^^64ocumentclass instead of \documentclass when you are inside the verbatim env.
>>
>> I guess that the ^^64 is parsed by TeX input processor, so it is not sensitive to verbatim catcodification. Am I wrong ?
>>
>> Vincent.
>>
>> ----------------------------------------
>>> To: ***@gnu.org
>>> From: ***@free.fr
>>> Date: Mon, 25 Jan 2016 22:45:40 +0100
>>> Subject: Re: [AUCTeX] overlay prompting
>>>
>>> Hi Mosè,
>>>
>>> Le 25/01/2016 21:21, Mosè Giordano a écrit :
>>>> Hi Jean-François,
>>>>
>>>> 2016-01-25 10:08 GMT+01:00 jfbu <***@free.fr>:
>>>>> My document has other AUCTeX-parsing related problems. For example
>>>>>
>>>>> \begin{verbatim}
>>>>> \usepackage{fontspec}
>>>>> \end{verbatim}
>>>>>
>>>>> similarly triggers AUCTeX to prompt me for xetex/luatex compilation.
>>>>> This made the workflow a bit painful, but I forgot about it last time
>>>>> as I was doing latex runs via a Makefile.
>>>>
>>>> (setq TeX-check-engine nil)
>>>>
>>>> makes the warning go away.
>>>
>>> ah yes, actually you already told me so in the fontspec thread,
>>> thanks for reminding me
>>>
>>>>
>>>>> Also, perhaps commands like \setmainfont also make AUCTeX's parser react,
>>>>> or is it only \documentclass and \usepackage ?
>>>>
>>>> \setmainfont isn't parsed.
>>>
>>> ok, then perhaps I will do the ¡ trick after all.
>>>
>>> Rather than \let¡\empty, I could also simply do \catcode`\¡ 9
>>> to tell TeX/LaTeX to ignore it rather than have it be active
>>> (which it is via \usepackage[latin1]{inputenc}) with an empty
>>> expansion
>>>
>>> best regards,
>>>
>>> Jean-François
>>>
>>>
>>> _______________________________________________
>>> auctex mailing list
>>> ***@gnu.org
>>> https://lists.gnu.org/mailman/listinfo/auctex
>>
>
jfbu
2016-03-01 22:54:10 UTC
Permalink
going on with top posting ...

Le 01/03/2016 20:55, Vincent Belaïche a écrit :
> Ok I see. I made some test, and character ÷ (obélus in French) is invisible in verbatim without any preparation provided that you are using OT1 font encoding. See:
>
> \documentclass{minimal}
> \usepackage[OT1]{fontenc}

I can not use OT1 in my document ;-).

> \begin{document}
> \verb+\÷documentclass+
> \end{document}
>
>
> Well, it would be nice if there was some character different from \
> btu for which font encoding generate the same glyph as \, then you
> could use this character in the verbatim in place of \, in order to
> foul the AUCTeX parser...

Actually verbatim sanitizes very few characters. In particular all
characters in the 128-255 range (if 8bit input encoding) or UTF-8
characters remain active and expand (naturally) to the correct slot
of the T1 fonts (not going into Unicode engines for simplicity here).

Hence one only needs to modify the definition of one such character
not elsewhere used. For example your obelus ÷ expands to \textdiv.
With \def\textdiv{\textbackslash} the trick is done.

I need to be able to copy paste from my document to
test the code snippets. It is easier for me to say to ignore
some character like ¡ rather than redefine some other character like ÷.

>
> One more idea to fool the parser : place all the verbatim stuff into
> a separate file and load it with verbatim input
> (http://www.tex.ac.uk/FAQ-verbfile.html).

In matters of verbatim, I prefer to handle it all myself ;-)


You could also place the
> verbatim stuff into some file my-stuff.tex, then process it by some
> script that verbatimize all the special characters (e.g. replace \ by
> \textbackslash) into some other file my-stuff-verb.tex, and then
> \input my-stuff-verb.tex (you would need a Makefile to do that).


This is not an option, because the file must be a stand-alone dtx file
that people can compile via tex foo.dtx or the like. Actually the
dtx self-extracts some files, not the opposite.

Not to say that this is no good work-flow, as on a bigger package
I have now split the source, and the dtx is build via make prior
to CTAN upload. Hence in this case definitely the things confusing
the AUCTeX parser could be relegated to auxiliary files I would
rarely have to deal with. In the case of the original dtx this
thread was started with, it was not big enough for me into going
into that approach.

The bigger dtx was becoming truly big, and AUCTeX parsing generally
speaking was starting to cause me problems ; I resisted the idea
of splitting a long time because I enjoyed search/replace for macro
names in one unique file ; I now have to do a bit more working
with multiple files. But loading is faster and I can use either
latex mode or doctex mode depending on which sub-file I am working on.

Actually, with the bigger dtx a Makefile triggers some scripts
which builds up the dtx suitable for CTAN, and strips it from
private comments during the build. My efficiency is much impeded
when I can't write insults in comments, but obviously when you
end up publishing your work on CTAN you have to be a bit careful.

Thanks to your obelus ÷ I now enjoy my private comments and feel
liberated.

>
> Not sure whether this was already said during the discussion, for
> your information you can disable automatic parse (info "(auctex)
> Parsing Files") by setting to nil TeX-parse-self and TeX-auto-save in
> file local way, so some local AUCTeX patch only on your machine would
> be not too annoying --- it is acceptable to wait for the 3s once and
> for all, or every time you press C-c C-n, the problem is waiting so
> much on C-x C-s.

Now that I have the ¡ inserted, I do not feel like I need to do these
things.


>
> One more idea on the AUCTeX front is as follows: the (verbatim-p) in
> Mosè's patch could be made conditional on some new variable
> TeX-parse-strict-p defaulting to nil, so the patch would (edited by
> hand from Mosè's patch, not tested) :>
> --- a/tex.el
> +++ b/tex.el
> @@ -4065,7 +4065,8 @@ you should not use something like `[\\(]' for a
> character range."
> (match-beginning (car b))))))
> (symbol (nth 2 entry))
> (match (nth 1 entry)))
> - (unless (TeX-in-comment)
> + (unless (or (TeX-in-comment)
> + (and TeX-parse-strict-p (TeX-verbatim-p)))
> (looking-at (nth 0 entry))
> (if (fboundp symbol)
> (funcall symbol match)
> So you would just make file-locally TeX-parse-strict-p true, and both TeX-auto-save TeX-parse-self false.
>

If only I at last learned e-Lisp some day...


> One more idea is the following : my speculation is that AUCTeX is
> slow because when you do (verbatim-p) or something like that in the
> code patch you will regexp search backward and forward, so if S is
> the size of the file to scan, you need to scan over potentially S^2
> characters instead of S because of the secondary search. Maybe it
> would be possible to make the code more efficient by scanning for
> \begin and \end commands at the same time as \documentclass and
> \usepackage, placing the search result into some variable and then
> using the search results to make it all.>


not competent to comment ;-)

> Vincent.

thanks,

Jean-François

>
> ----------------------------------------
>> Subject: Re: [AUCTeX] overlay prompting
>> From: ***@free.fr
>> Date: Tue, 1 Mar 2016 08:10:20 +0100
>> CC: ***@gnu.org
>> To: ***@hotmail.fr
>>
>> Bonjour Vincent
>>
>> let's take a risk and reply without testing either ;-)
>>
>> I trust the \^^64ocumentclass will fool the AUCTeX parser (it should ;-) )
>> but the problem is that within a verbatim the ^ is sanitized to catcode 12.
>> Thus the latex run will actually print verbatim ^^64.
>>
>> The ^^ input form needs ^ to be of catcode 7.
>>
>> It actually works with any catcode 7 character (I used this in the source
>> of a package). For example && if you do \catcode`& 7.
>>
>> But & is also sanitized by verbatim:
>>
>> ~$ latexdef dospecials
>>
>> \dospecials:
>> macro:->\do \ \do \\\do \{\do \}\do \$\do \&\do \#\do \^\do \_\do \%\do \~
>>
>> and besides, I may need it to naturally for tabulars.
>>
>> Thus this approach would need at least the same amount of preparation
>> as the technique of \doc¡umentclass which I adopted near the end of the
>> thread (which works using \catcode`\¡ 9 ).
>>
>> Best, Jean-François
>>
>> Le 29 févr. 2016 à 23:38, Vincent Belaïche <***@hotmail.fr> a écrit :
>>
>>> Salut Jean-François,
>>>
>>> Not tested idea :
>>>
>>> Can't you fool the parser by writing \^^64ocumentclass instead of \documentclass when you are inside the verbatim env.
>>>
>>> I guess that the ^^64 is parsed by TeX input processor, so it is not sensitive to verbatim catcodification. Am I wrong ?
>>>
>>> Vincent.
>>>
>>> ----------------------------------------
>>>> To: ***@gnu.org
>>>> From: ***@free.fr
>>>> Date: Mon, 25 Jan 2016 22:45:40 +0100
>>>> Subject: Re: [AUCTeX] overlay prompting
>>>>
>>>> Hi Mosè,
>>>>
>>>> Le 25/01/2016 21:21, Mosè Giordano a écrit :
>>>>> Hi Jean-François,
>>>>>
>>>>> 2016-01-25 10:08 GMT+01:00 jfbu <***@free.fr>:
>>>>>> My document has other AUCTeX-parsing related problems. For example
>>>>>>
>>>>>> \begin{verbatim}
>>>>>> \usepackage{fontspec}
>>>>>> \end{verbatim}
>>>>>>
>>>>>> similarly triggers AUCTeX to prompt me for xetex/luatex compilation.
>>>>>> This made the workflow a bit painful, but I forgot about it last time
>>>>>> as I was doing latex runs via a Makefile.
>>>>>
>>>>> (setq TeX-check-engine nil)
>>>>>
>>>>> makes the warning go away.
>>>>
>>>> ah yes, actually you already told me so in the fontspec thread,
>>>> thanks for reminding me
>>>>
>>>>>
>>>>>> Also, perhaps commands like \setmainfont also make AUCTeX's parser react,
>>>>>> or is it only \documentclass and \usepackage ?
>>>>>
>>>>> \setmainfont isn't parsed.
>>>>
>>>> ok, then perhaps I will do the ¡ trick after all.
>>>>
>>>> Rather than \let¡\empty, I could also simply do \catcode`\¡ 9
>>>> to tell TeX/LaTeX to ignore it rather than have it be active
>>>> (which it is via \usepackage[latin1]{inputenc}) with an empty
>>>> expansion
>>>>
>>>> best regards,
>>>>
>>>> Jean-François
>>>>
>>>>
>>>> _______________________________________________
>>>> auctex mailing list
>>>> ***@gnu.org
>>>> https://lists.gnu.org/mailman/listinfo/auctex
>>>
>>
>
>
jfbu
2016-03-02 08:20:01 UTC
Permalink
Le 01/03/2016 23:54, jfbu a écrit :
> Hence one only needs to modify the definition of one such character
> not elsewhere used. For example your obelus ÷ expands to \textdiv.
> With \def\textdiv{\textbackslash} the trick is done.

Some LaTeX complements are needed here, because I got some
surprises. First one needs package textcomp (which may be loaded
by default by some font packages). But then, turns out my last
experience was with an utf-8 encoded source.

% -*- coding: utf-8; -*-
\documentclass{article}
\usepackage[TS1,T1]{fontenc}
\usepackage{textcomp}
\usepackage[utf8]{inputenc}

\begin{document}
\meaning\textdiv

{
\tracingmacros 1
÷
}

\end{document}

However if one uses (as has been prevalently for me the
case because I usually have no use for UTF-8 and LaTeX
fills the log with dozens of extra lines if one uses it)

% -*- coding: iso-latin-1; -*-
\documentclass{article}
\usepackage[TS1,T1]{fontenc}
\usepackage{textcomp}
\usepackage[latin1]{inputenc}

\begin{document}
\meaning\textdiv

{
\tracingmacros 1
÷
}

\end{document}

one gets an error because ÷ is configured to expand to \div
which is math-mode only.

I traced this to \DeclareInputMath{247}{\div} in latin1.def
to be compared with \DeclareUnicodeCharacter{00F7}{\textdiv}
in file ts1enc.dfu used by inputenc in case of utf8 encoding.

This discrepancy looks like a LaTeX bug I never went to the
effort of completely examining the inputenc dealings.


Jean-François
jfbu
2016-03-03 07:07:15 UTC
Permalink
Le 02/03/2016 09:20, jfbu a écrit :
> Le 01/03/2016 23:54, jfbu a écrit :
>> Hence one only needs to modify the definition of one such character
>> not elsewhere used. For example your obelus ÷ expands to \textdiv.
>> With \def\textdiv{\textbackslash} the trick is done.
>
> Some LaTeX complements are needed here, because I got some
> surprises. First one needs package textcomp (which may be loaded
> by default by some font packages). But then, turns out my last
> experience was with an utf-8 encoded source.
>


https://www.latex-project.org/cgi-bin/ltxbugs2html?pr=latex/4454&introduction=yes&state=open

Best,
Jean-François
Mosè Giordano
2016-03-02 00:06:49 UTC
Permalink
Hi Vincent,
> One more idea is the following : my speculation is that AUCTeX is slow because when you do (verbatim-p) or something like that in the code patch you will regexp search backward and forward, so if S is the size of the file to scan, you need to scan over potentially S^2 characters instead of S because of the secondary search. Maybe it would be possible to make the code more efficient by scanning for \begin and \end commands at the same time as \documentclass and \usepackage, placing the search result into some variable and then using the search results to make it all.

You're right, the bottleneck in `LaTeX-verbatim-p' is
`LaTeX-current-environment' which performs multiple searches, but is
also capable to determine outer environments than the innermost one.
We could use a simpler version just for `LaTeX-verbatim-p' (we do need
the innermost environment there), though I'm not sure doing the whole
search in one shot would improve performance, but I didn't test.

Bye,
Mosè
Mosè Giordano
2016-01-24 14:46:30 UTC
Permalink
2016-01-24 15:14 GMT+01:00 Mosè Giordano <***@gnu.org>:
> The obvious
> fix would be to do said test, but I fear parsing time would increase
> sensibly. I should do some tests.

In a 1850-line-long document of mine, parsing time increases by a
factor of 3 when including the test for verbatim mode. I don't think
this is acceptable.

For those wanting to test, this is the patch for `TeX-auto-parse-region':

--- a/tex.el
+++ b/tex.el
@@ -4065,7 +4065,8 @@ you should not use something like `[\\(]' for a
character range."
(match-beginning (car b))))))
(symbol (nth 2 entry))
(match (nth 1 entry)))
- (unless (TeX-in-comment)
+ (unless (or (TeX-in-comment)
+ (TeX-verbatim-p))
(looking-at (nth 0 entry))
(if (fboundp symbol)
(funcall symbol match)


Bye,
Mosè
jfbu
2016-01-24 14:49:42 UTC
Permalink
Le 24 janv. 2016 à 15:46, Mosè Giordano <***@gnu.org> a écrit :

> 2016-01-24 15:14 GMT+01:00 Mosè Giordano <***@gnu.org>:
>> The obvious
>> fix would be to do said test, but I fear parsing time would increase
>> sensibly. I should do some tests.
>
> In a 1850-line-long document of mine, parsing time increases by a
> factor of 3 when including the test for verbatim mode. I don't think
> this is acceptable.
>
> For those wanting to test, this is the patch for `TeX-auto-parse-region':
>
> --- a/tex.el
> +++ b/tex.el
> @@ -4065,7 +4065,8 @@ you should not use something like `[\\(]' for a
> character range."
> (match-beginning (car b))))))
> (symbol (nth 2 entry))
> (match (nth 1 entry)))
> - (unless (TeX-in-comment)
> + (unless (or (TeX-in-comment)
> + (TeX-verbatim-p))
> (looking-at (nth 0 entry))
> (if (fboundp symbol)
> (funcall symbol match)
>

how do you time the parsing ?
Best,
Jean-François
Mosè Giordano
2016-01-24 14:54:40 UTC
Permalink
2016-01-24 15:49 GMT+01:00 jfbu <***@free.fr>:
> how do you time the parsing ?

With `benchmark-run'. In the file buffer run

M-: (benchmark-run (TeX-auto-parse)) RET

The first argument of `benchmark-run' can be the number of the
repetitions of the form.

Cheers,
Mosè
jfbu
2016-01-24 15:05:09 UTC
Permalink
Le 24 janv. 2016 à 15:54, Mosè Giordano <***@gnu.org> a écrit :

> 2016-01-24 15:49 GMT+01:00 jfbu <***@free.fr>:
>> how do you time the parsing ?
>
> With `benchmark-run'. In the file buffer run
>
> M-: (benchmark-run (TeX-auto-parse)) RET
>
> The first argument of `benchmark-run' can be the number of the
> repetitions of the form.
>


I got this before the patch

(0.087632 1 0.029196999999999917)

and after the patch:

(3.623112 30 0.7104439999999999)

in the mean time I patched tex.el, byte-compiled and loaded it.

Thus it seems I have indeed a rather drastic time increase
with my big document.

I also tried C-cC-n and had indeed about three seconds wait.

The .el file has no beamer anymore.

But obviously, I am tempted to conclude that
time penalty is too big.

Best,

Jean-François
Mosè Giordano
2016-01-24 15:12:58 UTC
Permalink
2016-01-24 16:05 GMT+01:00 jfbu <***@free.fr>:
>
> Le 24 janv. 2016 à 15:54, Mosè Giordano <***@gnu.org> a écrit :
>
>> 2016-01-24 15:49 GMT+01:00 jfbu <***@free.fr>:
>>> how do you time the parsing ?
>>
>> With `benchmark-run'. In the file buffer run
>>
>> M-: (benchmark-run (TeX-auto-parse)) RET
>>
>> The first argument of `benchmark-run' can be the number of the
>> repetitions of the form.
>>
>
>
> I got this before the patch
>
> (0.087632 1 0.029196999999999917)
>
> and after the patch:
>
> (3.623112 30 0.7104439999999999)
>
> in the mean time I patched tex.el, byte-compiled and loaded it.
>
> Thus it seems I have indeed a rather drastic time increase
> with my big document.
>
> I also tried C-cC-n and had indeed about three seconds wait.
>
> The .el file has no beamer anymore.
>
> But obviously, I am tempted to conclude that
> time penalty is too big.

`LaTeX-verbatim-p' looks first at the face at point, then to the
current macro, and if all previous tests are nil, which is the most
common case, runs also `LaTeX-current-environment', which is known to
be *slow*.

I think current parsing time is acceptable, less than 0.1 s in your
long and complex document is reasonably low, and I hoped that there
were already the test for verbatim mode. But since this test is not
there, adding it wouldn't be a fair trade-off.

Bye,
Mosè
jfbu
2016-01-24 15:18:23 UTC
Permalink
Le 24 janv. 2016 à 16:12, Mosè Giordano <***@gnu.org> a écrit :

> 2016-01-24 16:05 GMT+01:00 jfbu <***@free.fr>:
>>
>> Le 24 janv. 2016 à 15:54, Mosè Giordano <***@gnu.org> a écrit :
>>
>>> 2016-01-24 15:49 GMT+01:00 jfbu <***@free.fr>:
>>>> how do you time the parsing ?
>>>
>>> With `benchmark-run'. In the file buffer run
>>>
>>> M-: (benchmark-run (TeX-auto-parse)) RET
>>>
>>> The first argument of `benchmark-run' can be the number of the
>>> repetitions of the form.
>>>
>>
>>
>> I got this before the patch
>>
>> (0.087632 1 0.029196999999999917)
>>
>> and after the patch:
>>
>> (3.623112 30 0.7104439999999999)
>>
>> in the mean time I patched tex.el, byte-compiled and loaded it.
>>
>> Thus it seems I have indeed a rather drastic time increase
>> with my big document.
>>
>> I also tried C-cC-n and had indeed about three seconds wait.
>>
>> The .el file has no beamer anymore.
>>
>> But obviously, I am tempted to conclude that
>> time penalty is too big.
>
> `LaTeX-verbatim-p' looks first at the face at point, then to the
> current macro, and if all previous tests are nil, which is the most
> common case, runs also `LaTeX-current-environment', which is known to
> be *slow*.
>
> I think current parsing time is acceptable, less than 0.1 s in your
> long and complex document is reasonably low, and I hoped that there
> were already the test for verbatim mode. But since this test is not
> there, adding it wouldn't be a fair trade-off.
>

current parsing time is barely noticeable; with the patch applied
however each time I change a single character and do C-xC-s I have
to wait a few seconds for it to complete (on my big test document).

Cheers

Jean-François
Loading...