[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 46b3db5: Widen buffer before going to point found by xref-find-de
From: |
Juri Linkov |
Subject: |
master 46b3db5: Widen buffer before going to point found by xref-find-definitions (bug#44294) |
Date: |
Thu, 29 Oct 2020 05:09:33 -0400 (EDT) |
branch: master
commit 46b3db5579e57b9daf16667914205adc99d3f104
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>
Widen buffer before going to point found by xref-find-definitions
(bug#44294)
* lisp/progmodes/elisp-mode.el (xref-location-marker): Widen before going
to the found position.
* lisp/progmodes/etags.el (etags-goto-tag-location): Rerun after removing
narrowing.
* lisp/simple.el (goto-line-read-args): Use buffer-narrowed-p.
---
lisp/progmodes/elisp-mode.el | 6 ++++--
lisp/progmodes/etags.el | 9 +++++++--
lisp/simple.el | 8 ++++----
3 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index eed73f5..c7ff351 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -897,8 +897,10 @@ non-nil result supersedes the xrefs produced by
(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))
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index f6af1f2..41ed317 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -1406,8 +1406,13 @@ hits the start of file."
offset (* 3 offset))) ; expand search window
(or found
(re-search-forward pat nil t)
- (user-error "Rerun etags: `%s' not found in %s"
- pat buffer-file-name)))
+ (if (and (buffer-narrowed-p) widen-automatically)
+ (progn
+ ;; Rerun after removing narrowing
+ (widen)
+ (etags-goto-tag-location tag-info))
+ (user-error "Rerun etags: `%s' not found in %s"
+ pat buffer-file-name))))
;; Position point at the right place
;; if the search string matched an extra Ctrl-m at the beginning.
(and (eq selective-display t)
diff --git a/lisp/simple.el b/lisp/simple.el
index a29f85b..2e40e32 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1291,11 +1291,11 @@ that uses or sets the mark."
"")))
;; Read the argument, offering that number (if any) as default.
(list (read-number (format "Goto%s line%s: "
- (if (= (point-min) 1) ""
- ;; In a narrowed buffer.
- (if relative " relative" " absolute"))
+ (if (buffer-narrowed-p)
+ (if relative " relative" " absolute")
+ "")
buffer-prompt)
- (list default (if (or relative (= (point-min) 1))
+ (list default (if (or relative (not
(buffer-narrowed-p)))
(line-number-at-pos)
(save-restriction
(widen)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 46b3db5: Widen buffer before going to point found by xref-find-definitions (bug#44294),
Juri Linkov <=