(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))
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)
"")))
;; 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)