(xref--show-xrefs fetcher display-action))
(defun xref--show-xrefs (fetcher display-action &optional _always-show-list)
- (xref--push-markers)
(unless (functionp fetcher)
;; Old convention.
(let ((xrefs fetcher))
(prog1
xrefs
(setq xrefs 'called-already)))))))
- (funcall xref-show-xrefs-function fetcher
- `((window . ,(selected-window))
- (display-action . ,display-action)
- (auto-jump . ,xref-auto-jump-to-first-xref))))
+ (let ((cb (current-buffer))
+ (pt (point)))
+ (funcall xref-show-xrefs-function fetcher
+ `((window . ,(selected-window))
+ (display-action . ,display-action)
+ (auto-jump . ,xref-auto-jump-to-first-xref)))
+ (xref--push-markers cb pt)))
(defun xref--show-defs (xrefs display-action)
- (xref--push-markers)
- (funcall xref-show-definitions-function xrefs
- `((window . ,(selected-window))
- (display-action . ,display-action)
- (auto-jump . ,xref-auto-jump-to-first-definition))))
-
-(defun xref--push-markers ()
- (unless (region-active-p) (push-mark nil t))
- (xref-push-marker-stack))
+ (let ((cb (current-buffer))
+ (pt (point)))
+ (funcall xref-show-definitions-function xrefs
+ `((window . ,(selected-window))
+ (display-action . ,display-action)
+ (auto-jump . ,xref-auto-jump-to-first-definition)))
+ (xref--push-markers cb pt)))
+
+(defun xref--push-markers (buf pt)
+ (when (buffer-live-p buf)
+ (save-excursion
+ (with-no-warnings (set-buffer buf))
+ (goto-char pt)
+ (unless (region-active-p) (push-mark nil t))
+ (xref-push-marker-stack))))
(defun xref--prompt-p (command)
(or (eq xref-prompt-for-identifier t)