mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-21 18:23:59 +00:00
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.
This commit is contained in:
parent
bb3d13ac35
commit
46b3db5579
@ -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))
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user