auctex
[Top][All Lists]
Advanced

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

Re: [AUCTeX] Listing and not listing regions inverted if `\begin{lstlist


From: Denis Bitouzé
Subject: Re: [AUCTeX] Listing and not listing regions inverted if `\begin{lstlisting}' not followed by what is expected
Date: Sun, 12 Apr 2015 11:19:26 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Hi Tassilo,

Le 10/04/15 à 11h36, Tassilo Horn <address@hidden> a écrit :

>> Bad news! But good news: I'm smarter than AUCTeX! ;)
>
> Humans write programs, so in general I hope we are all smarter than the
> programs we produce.  At least in the middle term.  And then comes the
> Terminator.  ;-)

SOS! ;)

> Anyway, keen to elaborate?  Did you manage to work around the issue?

Not at the moment: I'm waiting for the AUCTeX's next release in order to
test what you implemented (currently only in current Git master).

>>> Basically, what AUCTeX' font-latex does is telling emacs that the
>>> contents of verbatim environments are a kind of string which should
>>> be highlighted using the verbatim face.  For that purpose, it has to
>>> tell emacs where the "quotes" (delimiters) of that string are.  For
>>> that, there's the "generic string fence" syntax class (|).  As an
>>> example, in
>>>
>>> \begin{lstlisting}
>>> foo bar
>>> \end{lstlisting}
>>>
>>> the newline character after \begin{lstlisting} and the \ of
>>> \end{lstlisting} have that |-syntax.  When the emacs encounters a char
>>> with that syntax, it *toggles* string highlighting.
>>
>> If I understand well, emacs knows:
>>
>> - \begin{lstlisting} is the opening,
>> - \ of \end{lstlisting} is the closing,
>>
>> "quote". Isn't it a kind of beginning or end notion?
>
> No, it just notes here is a "quote" and there is a "quote".  You only
> know if its an opening or closing quote when you start counting all
> quotes from the beginning of the buffer, i.e., all oddly numbered quotes
> are opening, all evenly numbered quotes are closing.

OK, I see.

>>> So long story short: I think we can get either argument highlighting
>>> right or we can get nested verbatim environments right but not both.
>>> And since your use-case, i.e., documenting how to use verbatim
>>> environments, is the only one which requires nested verbatim
>>> environments, I think the current implementation which fontifies
>>> arguments correctly, is more useful for the majority of users.
>>
>> Indeed.
>
> As a workaround for your use-case: how about putting the contents of
> the top-level listings into separate files and then use
> \lstinputlisting?

Indeed.

Thanks!
-- 
Denis



reply via email to

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