[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master d3ab64f8 3/3: Reduce redundancy in regexp
From: |
Ikumi Keita |
Subject: |
master d3ab64f8 3/3: Reduce redundancy in regexp |
Date: |
Sat, 17 Dec 2022 07:12:52 -0500 (EST) |
branch: master
commit d3ab64f89394d16473ee1af144d5cf6bde77380c
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>
Reduce redundancy in regexp
* latex.el (LaTeX-environment-name-regexp): Don't quote regexp inside
[^...].
(LaTeX-modify-environment): Omit spurious regexp group. (already
given by `LaTeX-environment-name-regexp')
---
latex.el | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/latex.el b/latex.el
index b41d7f9b..8d181f69 100644
--- a/latex.el
+++ b/latex.el
@@ -848,10 +848,9 @@ environment just inserted, the buffer position just before
"Return the regexp matching the name of a LaTeX environment.
This matches everything different from a TeX closing brace but
allowing one level of TeX group braces."
- (concat "\\([^" (regexp-quote TeX-grcl) (regexp-quote TeX-grop) "]*\\("
- (regexp-quote TeX-grop) "[^" (regexp-quote TeX-grcl)
- (regexp-quote TeX-grop) "]*" (regexp-quote TeX-grcl) "\\)*[^"
- (regexp-quote TeX-grcl) (regexp-quote TeX-grop) "]*\\)"))
+ (concat "\\([^" TeX-grcl TeX-grop "]*\\(" (regexp-quote TeX-grop)
+ "[^" TeX-grcl TeX-grop "]*" (regexp-quote TeX-grcl) "\\)*[^"
+ TeX-grcl TeX-grop "]*\\)"))
(defvar LaTeX-after-modify-env-hook nil
"List of functions to be run at the end of `LaTeX-modify-environment'.
@@ -867,9 +866,7 @@ position just before \\begin and the position just before
(re-search-backward (concat (regexp-quote TeX-esc)
"end"
(regexp-quote TeX-grop)
- "\\("
(LaTeX-environment-name-regexp)
- "\\)"
(regexp-quote TeX-grcl))
(line-beginning-position))))
(goto-begin (lambda ()
@@ -878,9 +875,7 @@ position just before \\begin and the position just before
(re-search-forward (concat (regexp-quote TeX-esc)
"begin"
(regexp-quote TeX-grop)
- "\\(?:"
(LaTeX-environment-name-regexp)
- "\\)"
(regexp-quote TeX-grcl))
(line-end-position))))))
(save-excursion
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master d3ab64f8 3/3: Reduce redundancy in regexp,
Ikumi Keita <=