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.
This commit is contained in:
Mattias Engdegård 2023-09-07 18:06:34 +02:00
parent 7c55bf59bb
commit e95d8562c0

View file

@ -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