auctex-diffs
[Top][All Lists]
Advanced

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

master bf66b302: Improve the previous commit slightly


From: Ikumi Keita
Subject: master bf66b302: Improve the previous commit slightly
Date: Sun, 18 Dec 2022 05:00:01 -0500 (EST)

branch: master
commit bf66b302a4afa297fc2322a875935fd9a4d47525
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>

    Improve the previous commit slightly
    
    * latex.el (LaTeX-current-environment,LaTeX-backward-up-environment):
    Move the task to find out the environment name from the latter to the
    former.
---
 latex.el | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/latex.el b/latex.el
index 8d181f69..7c293066 100644
--- a/latex.el
+++ b/latex.el
@@ -905,16 +905,21 @@ environment in commented regions with the same comment 
prefix.
 
 The functions `LaTeX-find-matching-begin' and `LaTeX-find-matching-end'
 work analogously."
-  (or (save-excursion (LaTeX-backward-up-environment arg t))
-      "document"))
+  (save-excursion
+    (if (LaTeX-backward-up-environment arg)
+        (progn
+          (re-search-forward (concat
+                              TeX-grop (LaTeX-environment-name-regexp)
+                              TeX-grcl))
+          (match-string-no-properties 1))
+      "document")))
 
-(defun LaTeX-backward-up-environment (&optional arg want-name)
+(defun LaTeX-backward-up-environment (&optional arg)
   "Move backward out of the enclosing environment.
 Helper function of `LaTeX-current-environment' and
 `LaTeX-find-matching-begin'.
 With optional ARG>=1, find that outer level.
 Return non-nil if the operation succeeded.
-Return the (outermost) environment name if WANT-NAME is non-nil.
 
 Assume the current point is on neither \"begin{foo}\" nor \"end{foo}\"."
   (setq arg (if arg (if (< arg 1) 1 arg) 1))
@@ -943,13 +948,7 @@ Assume the current point is on neither \"begin{foo}\" nor 
\"end{foo}\"."
         (setq arg (if (= (char-after (match-beginning 1)) ?e)
                       (1+ arg)
                     (1- arg)))))
-    (if (= arg 0)
-        (or (not want-name)
-            (progn
-              (looking-at (concat (regexp-quote TeX-esc) "begin *"
-                                  TeX-grop (LaTeX-environment-name-regexp)
-                                  TeX-grcl))
-              (match-string-no-properties 1))))))
+    (= arg 0)))
 
 (defun docTeX-in-macrocode-p ()
   "Determine if point is inside a macrocode environment."



reply via email to

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