Subject: bug#29538: 26.0.90; Gnus, group buffer: Mouse click on empty space selects group

From: Benjamin Riefenstahl <[email-masked]>
Date: Mon, 04 Dec 2017 20:47:53 +0100

Hi,

Thank you for looking into this.

> On Sat, 02 Dec 2017 21:15:37 +0100, Benjamin Riefenstahl wrote:
>> The behaviour of mouse clicks has changed in the Gnus group buffer from
>> Emacs 25 to Emacs 26.

Katsumi Yamaoka writes:
> I found no difference in the end of a group line between 25 and 26.
> Don't you have a special treatment on `gnus-mouse-2'?  In Emacs 25
> the default value of it is `[mouse-2]' that Emacs 26 directly uses
> instead of `gnus-mouse-2'.

What is `gnus-mouse-2'?  I do not seem to have a variable or function of
that name.

I tried C-h k mouse-1 after the line end and also inside the group
string.

For Enacs 25 I get this for after the line end:

    <down-mouse-1> at that spot runs the command mouse-drag-region (found
    in global-map), [...]

    ----------------- up-event ----------------

    <mouse-1> at that spot runs the command mouse-set-point (found in
    global-map), [...]

Inside the groups string I get:

    <down-mouse-1> (translated from <mouse-1>) at that spot runs the
    command mouse-drag-region (found in global-map), [...]

    ----------------- up-event ----------------

    <mouse-2> at that spot runs the command gnus-mouse-pick-topic (found
    in gnus-topic-mode-map), [...]

While for Emacs 26 I get this for both:

    <down-mouse-1> at that spot runs the command mouse-drag-region (found
    in global-map), [...]

    ----------------- up-event (short click) ----------------

    <mouse-2> at that spot is remapped to <mouse-2>, which runs the
    command gnus-mouse-pick-topic (found in gnus-topic-mode-map), [...]

    ----------------- up-event (long click) ----------------

    Pressing <mouse-1> at that spot for longer than 450 milli-seconds
    runs the command mouse-set-point (found in global-map), [...]

IOW, after the line end there is an additional handler for mouse-2 in
Emacs 26, that was not there in Emacs 25.

> Otherwise, isn't it due to your setting of
> `mouse-1-click-follows-link' or
> `mouse-1-click-in-non-selected-windows'?

`mouse-1-click-in-non-selected-windows' would change this particular
behaviour, but it is not what I want either :-(.  I prefer to have a
button or link activate when I click on it, without having to care if
the frame was active or not.  It's just that in the case of the Gnus
group buffer, the whole client space is active, even where it used to be
not (and IMO should not be).

> Making the mouse click do so is easy anyway:
>
> (defadvice gnus-mouse-pick-group (around do-nothing-in-lineend activate)
>   "Do nothing in the line end."
>   (mouse-set-point e)
>   (or (eolp) ad-do-it))

That works for me, thank you.  It's `gnus-mouse-pick-topic' for me,
because I have topics activated, sorry for not mentioning that before.
(If I disable topics, the same problem occurs, so that by itself seems
not to be the cause of this.)

benny