From 9b31ad36094666da6b3281025adc163829d89de8 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 18 Aug 2021 20:02:39 +0300 Subject: [PATCH] * lisp/progmodes/xref.el (xref--collect-matches): Widen temporarily. --- lisp/progmodes/xref.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 69378a561ea..d3780d571fc 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1729,12 +1729,14 @@ Such as the current syntax table and the applied syntax properties." (if buf (with-current-buffer buf (save-excursion - (goto-char (point-min)) - (forward-line (1- line)) - (xref--collect-matches-1 regexp file line - (line-beginning-position) - (line-end-position) - syntax-needed))) + (save-restriction + (widen) + (goto-char (point-min)) + (forward-line (1- line)) + (xref--collect-matches-1 regexp file line + (line-beginning-position) + (line-end-position) + syntax-needed)))) ;; Using the temporary buffer is both a performance and a buffer ;; management optimization. (with-current-buffer tmp-buffer -- 2.39.2