@table @kbd
@item @key{RET}
-@itemx mouse-2
+@itemx mouse-1
Display the reference on the current line (@code{xref-goto-xref}).
With prefix argument, also bury the @file{*xref*} buffer.
+@item mouse-2
+The same as @code{mouse-1}, but make the window displaying the
+@file{*xref*} buffer the selected window
+(@code{xref-select-and-goto-xref}).
+
@item n
@itemx .
@findex xref-next-line
(defvar xref--button-map
(let ((map (make-sparse-keymap)))
(define-key map [mouse-1] #'xref-goto-xref)
- (define-key map [mouse-2] #'xref--mouse-2)
+ (define-key map [mouse-2] #'xref-select-and-goto-xref)
map))
-(defun xref--mouse-2 (event)
- "Move point to the button and show the xref definition."
+(defun xref-select-and-goto-xref (event)
+ "Move point to the button and show the xref definition.
+The window showing the xref buffer will be selected."
(interactive "e")
(mouse-set-point event)
(forward-line 0)
(or (get-text-property (point) 'xref-item)
(xref--search-property 'xref-item))
(xref-show-location-at-point))
+(define-obsolete-function-alias
+ 'xref--mouse-2 #'xref-select-and-goto-xref "28.1")
(defcustom xref-truncation-width 400
"The column to visually \"truncate\" each Xref buffer line to."