auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] [elpa] externals/auctex fa8842c626 26/60: Recognize macro


From: Tassilo Horn
Subject: [AUCTeX-diffs] [elpa] externals/auctex fa8842c626 26/60: Recognize macrocode*? environments in doctex-mode
Date: Fri, 8 Apr 2022 11:52:50 -0400 (EDT)

branch: externals/auctex
commit fa8842c626996a60dbd99e420d6bfb683be28fe4
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>

    Recognize macrocode*? environments in doctex-mode
    
    * latex.el (LaTeX-current-environment): Don't ignore whitespaces
    and other characters than letters in regexp for searching the name
    of the environment.  In doctex-mode, handle the macrocode*?
    environments specially and find them if invoked from a non-comment
    line.
---
 latex.el | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/latex.el b/latex.el
index d48522fee0..4de9760016 100644
--- a/latex.el
+++ b/latex.el
@@ -917,7 +917,7 @@ work analogously."
     (save-excursion
       (while (and (/= arg 0)
                   (re-search-backward
-                   "\\\\\\(begin\\|end\\) *{ *\\([A-Za-z*]+\\) *}" nil t))
+                   "\\\\\\(begin\\|end\\) *{\\([^}]+\\)}" nil t))
         (when (or (and LaTeX-syntactic-comments
                        (eq in-comment (TeX-in-commented-line))
                        (or (not in-comment)
@@ -925,7 +925,15 @@ work analogously."
                            ;; commented case.
                            (string= comment-prefix (TeX-comment-prefix))))
                   (and (not LaTeX-syntactic-comments)
-                       (not (TeX-in-commented-line))))
+                       (not (TeX-in-commented-line)))
+                  ;; macrocode*? in docTeX-mode is special since we
+                  ;; have also regular code lines not starting with a
+                  ;; comment-prefix.  Hence, the next check just looks
+                  ;; if we're inside such a group and returns t to
+                  ;; recognize such a situation.
+                  (and (eq major-mode 'doctex-mode)
+                       (member (match-string-no-properties 2)
+                               '("macrocode" "macrocode*"))))
           (setq arg (if (string= (match-string 1) "end") (1+ arg) (1- arg)))))
       (if (/= arg 0)
           "document"




reply via email to

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