From 78d0b9b3f8f0e5e2ccebb94823f710bcb8518233 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Mon, 12 Aug 2024 15:13:00 +0200 Subject: [PATCH] * elisp-mode.el (xref-backend-references): Be more cautious. --- lisp/progmodes/elisp-mode.el | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 5490ef8dc52..07602d3ad6c 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -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) -- 2.39.2