[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#73302: TeX-find-closing-brace and verbatim macros
From: |
Paul Nelson |
Subject: |
bug#73302: TeX-find-closing-brace and verbatim macros |
Date: |
Fri, 20 Sep 2024 06:40:18 +0200 |
Hi again,
I noticed just now that my patch can break the folding of
\end{verbatim} environments when called via TeX-fold-region. Steps to
reproduce:
1. After loading AUCTeX and tex-fold, evaluate
(add-to-list 'TeX-fold-macro-spec-list '(identity ("end")))
2. Create a LaTeX file containing
\begin{verbatim}
blah
\end{verbatim}
3. Make the region contain the line "\end{verbatim}", but none of the
line "\begin{verbatim}"
4. C-c C-o C-r (TeX-fold-region).
This results in [Error: No content or function found], resulting from
a failure for TeX-fold-macro-nth-arg to recover the first argument to
\end{verbatim}.
One can trace the issue to the following discrepancy:
a. With point on the "{" in "\end{verbatim}", (TeX-verbatim-p) returns
nil (as expected).
b. If we repeat (a) after narrowing to a region that contains the line
"\end{verbatim}" but none of the line "\begin{verbatim}", then it
instead returns t.
As a fix, we could either:
(i) Do (save-restriction (widen) ...) in TeX-fold-macro-nth-arg before
(TeX-verbatim-p).
(ii) Do (save-restriction (widen) ...) in LaTeX-verbatim-p.
The advantage of (ii) is that it arguably fixes the root cause rather
than just patching it at the source. The disadvantage is that I don't
know off hand whether this would affect other calls to
LaTeX-verbatim-p in an undesired way. I lean in favor of (i) for now,
and have updated my patch accordingly, but would welcome other
feedback.
Paul
0001-Fix-folding-of-verbatim-macros.patch
Description: Binary data
- bug#73302: TeX-find-closing-brace and verbatim macros, Paul Nelson, 2024/09/16
- bug#73302: TeX-find-closing-brace and verbatim macros, Arash Esbati, 2024/09/16
- bug#73302: TeX-find-closing-brace and verbatim macros, Paul Nelson, 2024/09/16
- bug#73302: TeX-find-closing-brace and verbatim macros, Paul Nelson, 2024/09/17
- bug#73302: TeX-find-closing-brace and verbatim macros, Ikumi Keita, 2024/09/19
- bug#73302: TeX-find-closing-brace and verbatim macros, Paul Nelson, 2024/09/19
- bug#73302: TeX-find-closing-brace and verbatim macros, Ikumi Keita, 2024/09/19
- bug#73302: TeX-find-closing-brace and verbatim macros, Paul Nelson, 2024/09/19
- bug#73302: TeX-find-closing-brace and verbatim macros,
Paul Nelson <=
- bug#73302: TeX-find-closing-brace and verbatim macros, Ikumi Keita, 2024/09/20
- bug#73302: TeX-find-closing-brace and verbatim macros, Arash Esbati, 2024/09/21
- bug#73302: TeX-find-closing-brace and verbatim macros, Paul Nelson, 2024/09/21
- bug#73302: TeX-find-closing-brace and verbatim macros, Arash Esbati, 2024/09/24
- bug#73302: TeX-find-closing-brace and verbatim macros, Ikumi Keita, 2024/09/26
- bug#73302: TeX-find-closing-brace and verbatim macros, Paul Nelson, 2024/09/26
- bug#73302: TeX-find-closing-brace and verbatim macros, Ikumi Keita, 2024/09/27
- bug#73302: TeX-find-closing-brace and verbatim macros, Arash Esbati, 2024/09/27
- bug#73302: TeX-find-closing-brace and verbatim macros, Paul Nelson, 2024/09/27
- bug#73302: TeX-find-closing-brace and verbatim macros, Arash Esbati, 2024/09/30