1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Simplify xref regular expression with rx

* lisp/progmodes/xref.el (xref--regexp-to-extended): switch to rx
regular expression for legibility
This commit is contained in:
Daniel Colascione 2024-10-05 22:07:11 -04:00
parent e776df2a3e
commit 500f5da5fb

View file

@ -2076,7 +2076,8 @@ directory, used as the root of the ignore globs."
(replace-regexp-in-string
;; FIXME: Add tests. Move to subr.el, make a public function.
;; Maybe error on Emacs-only constructs.
"\\(?:\\\\\\\\\\)*\\(?:\\\\[][]\\)?\\(?:\\[.+?\\]\\|\\(\\\\?[(){}|]\\)\\)"
(rx (zero-or-more "\\\\") (opt "\\" (any "[]"))
(or (seq "[" (+? nonl) "]") (group (opt "\\") (any "(){|}"))))
(lambda (str)
(cond
((not (match-beginning 1))