]> git.eshelyaron.com Git - emacs.git/commitdiff
* elisp-mode.el (xref-backend-references): Be more cautious.
authorEshel Yaron <me@eshelyaron.com>
Mon, 12 Aug 2024 13:13:00 +0000 (15:13 +0200)
committerEshel Yaron <me@eshelyaron.com>
Mon, 12 Aug 2024 13:21:23 +0000 (15:21 +0200)
lisp/progmodes/elisp-mode.el

index 5490ef8dc528d3706c01f6ab15f00384369a6a41..07602d3ad6c5f70f5e92314992b0dec4b8004b53 100644 (file)
@@ -1151,20 +1151,21 @@ namespace but with lower confidence."
                (pcase-lambda (`(,beg ,len ,bin))
                  (when (<= beg pos (+ beg len)) bin))
                all)))
-    (if dec (seq-keep (pcase-lambda (`(,sym ,len ,bin))
-                        (when (equal bin dec)
-                          (let* ((beg-end (save-excursion
-                                            (goto-char sym)
-                                            (cons (pos-bol) (pos-eol))))
-                                 (beg (car beg-end))
-                                 (end (cdr beg-end))
-                                 (line (buffer-substring-no-properties beg end))
-                                 (cur (- sym beg)))
-                            (add-face-text-property cur (+ len cur)
-                                                    'xref-match t line)
-                            (xref-make line (xref-make-buffer-location
-                                             (current-buffer) sym)))))
-                      all)
+    (if (numberp dec)
+        (seq-keep (pcase-lambda (`(,sym ,len ,bin))
+                    (when (equal bin dec)
+                      (let* ((beg-end (save-excursion
+                                        (goto-char sym)
+                                        (cons (pos-bol) (pos-eol))))
+                             (beg (car beg-end))
+                             (end (cdr beg-end))
+                             (line (buffer-substring-no-properties beg end))
+                             (cur (- sym beg)))
+                        (add-face-text-property cur (+ len cur)
+                                                'xref-match t line)
+                        (xref-make line (xref-make-buffer-location
+                                         (current-buffer) sym)))))
+                  all)
       (cl-call-next-method backend identifier))))
 
 (defun elisp--xref-filter-definitions (definitions namespace symbol)