[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#9917: bug#5042: bug#9917: 24.0.90; Make `goto-line' consistent with
From: |
Juri Linkov |
Subject: |
bug#9917: bug#5042: bug#9917: 24.0.90; Make `goto-line' consistent with the line number from the minibuffer |
Date: |
Tue, 27 Oct 2020 22:52:10 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
> This is what for example help-function-def--button-function does:
>
> ;; Widen the buffer if necessary to go to this position.
> (when (or (< position (point-min))
> (> position (point-max)))
> (widen))
> (goto-char position)
>
> Unfortunately, xref doesn't provide such nice feature,
> so 'M-.' fails to navigate in a narrowed buffer.
Here is the fix for xref:
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index eed73f5791..c7ff351845 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -897,8 +897,10 @@ xref-location-marker
(let ((buffer-point (find-function-search-for-symbol symbol type file)))
(with-current-buffer (car buffer-point)
(save-excursion
- (goto-char (or (cdr buffer-point) (point-min)))
- (point-marker))))))
+ (save-restriction
+ (widen)
+ (goto-char (or (cdr buffer-point) (point-min)))
+ (point-marker)))))))
(cl-defmethod xref-location-group ((l xref-elisp-location))
(xref-elisp-location-file l))
- bug#9917: bug#5042: bug#9917: 24.0.90; Make `goto-line' consistent with the line number from the minibuffer,
Juri Linkov <=