[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master e95d8562c06: Translate backslash-saturated regexp to rx
From: |
Mattias Engdegård |
Subject: |
master e95d8562c06: Translate backslash-saturated regexp to rx |
Date: |
Thu, 7 Sep 2023 12:23:17 -0400 (EDT) |
branch: master
commit e95d8562c06c08d701330a640a6e9d8adda99580
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>
Translate backslash-saturated regexp to rx
* lisp/minibuffer.el (minibuffer--regexp-propertize):
The original regexp had 83 backslashes in 147 characters which may be
some kind of record. This transformation cuts it down to 6, and the
generated regexp string is about 14 % shorter.
---
lisp/minibuffer.el | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 8c642b15a4d..2120e31775e 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -4676,8 +4676,14 @@ and `blink-matching-paren' more user-friendly."
(remove-text-properties (point-min) (point-max) '(syntax-table nil))
(goto-char (point-min))
(while (re-search-forward
-
"\\(\\\\\\\\\\)\\|\\(?:\\(?:\\\\\\)\\(?:\\([(){}]\\)\\|\\(\\[\\)\\|\\(\\]\\)\\)\\)\
-\\|\\(\\[:[a-zA-Z]+:\\]\\)\\|\\(\\[\\)\\|\\(\\]\\)\\|\\([(){}]\\)"
+ (rx (| (group "\\\\")
+ (: "\\" (| (group (in "(){}"))
+ (group "[")
+ (group "]")))
+ (group "[:" (+ (in "A-Za-z")) ":]")
+ (group "[")
+ (group "]")
+ (group (in "(){}"))))
(point-max) 'noerror)
(cond
((match-beginning 1)) ; \\, skip
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master e95d8562c06: Translate backslash-saturated regexp to rx,
Mattias Engdegård <=