[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX] overlay prompting

From: Vincent Belaïche
Subject: Re: [AUCTeX] overlay prompting
Date: Tue, 1 Mar 2016 20:55:03 +0100

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. 


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


> Subject: Re: [AUCTeX] overlay prompting
> From: address@hidden
> Date: Tue, 1 Mar 2016 08:10:20 +0100
> CC: address@hidden
> To: address@hidden
> 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 <address@hidden> 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: address@hidden
>>> From: address@hidden
>>> 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 <address@hidden>:
>>>>> 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
>>> address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]