]> git.eshelyaron.com Git - emacs.git/commitdiff
Simplify xref regular expression with rx
authorDaniel Colascione <dancol@dancol.org>
Sun, 6 Oct 2024 02:07:11 +0000 (22:07 -0400)
committerEshel Yaron <me@eshelyaron.com>
Sun, 6 Oct 2024 12:22:11 +0000 (14:22 +0200)
* lisp/progmodes/xref.el (xref--regexp-to-extended): switch to rx
regular expression for legibility

(cherry picked from commit 500f5da5fb62cd0bbded8df754d93e3147d1d847)

lisp/progmodes/xref.el

index 42a6befc907e23c461683d367161a31bc9cb7013..221b715d850e06e3b294f79987527551f74c4e02 100644 (file)
@@ -2156,7 +2156,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))