emacs-diffs
[Top][All Lists]
Advanced

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

master 500f5da5fb6: Simplify xref regular expression with rx


From: Daniel Colascione
Subject: master 500f5da5fb6: Simplify xref regular expression with rx
Date: Sat, 5 Oct 2024 22:41:02 -0400 (EDT)

branch: master
commit 500f5da5fb62cd0bbded8df754d93e3147d1d847
Author: Daniel Colascione <dancol@dancol.org>
Commit: Daniel Colascione <dancol@dancol.org>

    Simplify xref regular expression with rx
    
    * lisp/progmodes/xref.el (xref--regexp-to-extended): switch to rx
    regular expression for legibility
---
 lisp/progmodes/xref.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index b841dc1d179..28bd42aebde 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -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))



reply via email to

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