bug#73302: TeX-find-closing-brace and verbatim macros
Hi Ikumi, OK, let me know how the attached looks. By the way, to clear up some of the confusion I expressed in an earlier message, I don't know whether a macro can have multiple verbatim arguments (some of which may be optional), and if so, then I don't know whether (LaTeX-verbatim-macro-boundaries) does the appropriate thing here (return the end of the macro argument, rather than the end of the entire macro). Thanks, best, Paul 0001-Fix-folding-of-verbatim-macros.patch Description: Binary data ___ bug-auctex mailing list bug-auctex@gnu.org https://lists.gnu.org/mailman/listinfo/bug-auctex
bug#73302: TeX-find-closing-brace and verbatim macros
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-auctex mailing list bug-auctex@gnu.org https://lists.gnu.org/mailman/listinfo/bug-auctex
bug#73302: TeX-find-closing-brace and verbatim macros
Hi Paul, > Paul Nelson writes: >> (Actually, AUCTeX has generic function `TeX-verbatim-p', but only LaTeX >> mode has meaningful implementation for it.) > According to the documentation, TeX-verbatim-p always returns nil > outside LaTeX-mode, so it seems to me that to fix the issue you raise, > it would suffice to use that function in place of LaTeX-verbatim-p > (rather than doing derive-mode-p checks). Does that sound right to > you? (I never use the other modes, so my knowledge there is a bit > spotty.) Hmm, then the code takes the form (if (TeX-verbatim-p) (cdr (LaTeX-verbatim-macro-boundaries)) ... , which looks like to call LaTeX-mode specific function `LaTeX-verbatim-macro-boundaries' in other modes as well... Well, I'd accept that if you place there some FIXME comments which warns that this should be fixed when other mode implements non-trivial `TeX-verbatim-p-function'. Regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine #Gaza #StopMassiveKilling #CeasefireNOW ___ bug-auctex mailing list bug-auctex@gnu.org https://lists.gnu.org/mailman/listinfo/bug-auctex
bug#73302: TeX-find-closing-brace and verbatim macros
Hi Paul, > Paul Nelson writes: > I took another look just now, and the fix to allow string specs was > simpler than I had thought. The attached patch suffices for my > practical purposes, but I'll confess that I don't know all the ways > verbatim arguments can appear in macros. TeX-fold-mode is supposed to run in none-LaTeX-mode buffers, so `LaTeX-verbatim-p' should be wrapped with some conditional using `derived-mode-p'. Can you work on it? (Actually, AUCTeX has generic function `TeX-verbatim-p', but only LaTeX mode has meaningful implementation for it.) Regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine #Gaza #StopMassiveKilling #CeasefireNOW ___ bug-auctex mailing list bug-auctex@gnu.org https://lists.gnu.org/mailman/listinfo/bug-auctex
bug#73302: TeX-find-closing-brace and verbatim macros
Hi Ikumi, Sure, I'd be happy to work on this. > TeX-fold-mode is supposed to run in none-LaTeX-mode buffers, so > `LaTeX-verbatim-p' should be wrapped with some conditional using > `derived-mode-p'. Can you work on it? > > (Actually, AUCTeX has generic function `TeX-verbatim-p', but only LaTeX > mode has meaningful implementation for it.) According to the documentation, TeX-verbatim-p always returns nil outside LaTeX-mode, so it seems to me that to fix the issue you raise, it would suffice to use that function in place of LaTeX-verbatim-p (rather than doing derive-mode-p checks). Does that sound right to you? (I never use the other modes, so my knowledge there is a bit spotty.) Thanks, best, Paul ___ bug-auctex mailing list bug-auctex@gnu.org https://lists.gnu.org/mailman/listinfo/bug-auctex