Subject: bug#76620: 30.1.50; mouse-1 mode-line bindings are unusable when point is on a button

From: Eli Zaretskii <[email-masked]>
Date: Fri, 28 Feb 2025 09:52:10 +0200

> Cc: Jonas Bernoulli <[email-masked]>
> Date: Thu, 27 Feb 2025 18:11:36 -0500
> From:  Spencer Baugh via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> 
> 1. emacs -Q
> 2. Position point over a button.el button, e.g.
>    (progn (view-emacs-news) (forward-button 1))
> 3. mouse-2 anywhere on the mode line.
> 4. Note that instead of the usual mouse-delete-other-windows binding,
>    the button at point is activated.
> 
> This is because the local keymap for buttons is button-map, which binds
> "<mode-line> <mouse-2>".  This is confusing, and probably a bug, but not
> too bad of a bug.
> 
> Substantially worse is this:
> 
> 5. mouse-1 on a part of the mode-line with a mouse-1 binding; for
>    example, mouse-1 on the buffer coding system indicator "U" at the
>    start of the mode line.
> 
> 6. Instead of describing the buffer's coding system, the button at point
>    is activated.
> 
> This is because mouse-1-click-follows-link translates the mouse-1 into a
> mouse-2.  This makes all mouse-1 bindings on the mode line basically
> broken while point is on a button.

The bugs with mouse-1 are solved on the master branch (see bug#75219).
So I can reproduce the last two items in Emacs 30, but not in Emacs
31.  The problems with mouse-2 are still present on the master branch.

> The mode-line (and header-line) binding was added to button.el in
> 24fc9480399b2d018e8d85f34e9c5d8c327ce3bf to support using buttons in the
> mode-line and header-line.  I suggest that we should remove those
> bindings, in favor of some other way to use button.el in the mode-line
> or header-line.  Especially because, from grepping through ~400 popular
> packages (the ones installed at my site), I see no usage of buttons in
> the mode-line or header-line.

Adding Stefan to the discussion.