Subject: Re: bug#35353: 26.2; Buffer *xref*: (1) hard-coded mouse-1, (2) major mode name

From: Dmitry Gutov <[email-masked]>
Date: Fri, 3 May 2019 01:48:30 +0300

On 22.04.2019 16:08, Drew Adams wrote:
> I
> see only `C-o' (`xref-show-location-at-point'),
> whose name says it does that, but only for point,
> not for the mouse position.  (And when I try `C-o'
> it too switches to another window, the same as `RET'.)

It doesn't do that over here.

> In any case, how is Xref different from, say, Occur
> wrt mouse actions and the general interaction?  What
> makes it so special that it should be problematic to
> fix this bug?

Honestly, it's quite easy. I'm pasting the code patch below.

Would you write the NEWS entry for it? And any necessary manual changes 
would be nice as well.

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index c7f015b94f..6dcdd75c84 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -722,8 +722,9 @@ xref--next-error-function
  (defvar xref--button-map
    (let ((map (make-sparse-keymap)))
      (define-key map [(control ?m)] #'xref-goto-xref)
-    (define-key map [mouse-1] #'xref-goto-xref)
-    (define-key map [mouse-2] #'xref--mouse-2)
+    (define-key map [follow-link] 'mouse-face)
+    (define-key map [mouse-2] #'xref-goto-xref)
+    (define-key map [mouse-3] #'xref--mouse-3)
      map))

  (defun xref--mouse-2 (event)