GNU bug report logs - #45820
menu-bar-mode: show drop-down menu instead of tmm-menubar in terminal Emacs

Previous Next

Package: emacs;

Reported by: Tim Lee <progscriptclone <at> gmail.com>

Date: Tue, 12 Jan 2021 17:47:02 UTC

Severity: normal

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 45820 in the body.
You can then email your comments to 45820 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#45820; Package emacs. (Tue, 12 Jan 2021 17:47:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tim Lee <progscriptclone <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 12 Jan 2021 17:47:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tim Lee <progscriptclone <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: menu-bar-mode: show drop-down menu instead of tmm-menubar in terminal
 Emacs
Date: Tue, 12 Jan 2021 23:30:31 +0800
[Message part 1 (text/plain, inline)]
The problem: In terminal Emacs, clicking on an item in the menu bar will
open "tmm-menubar".

Expected behavior: "menu-bar-open" should be run instead (i.e. a
drop-down menu should appear instead of tmm-menubar).

For example, if I left-click on the "Edit" menu item in the menu bar, I
expect the "Edit" drop-down to appear. Currently however, a left-click
on a menu item will open tmm-menubar in a *Completions* window. This is
surprising behavior.

By default, in terminal Emacs, "<menu-bar> <mouse-1>" is bound to
"tmm-menubar-mouse". There doesn't seem to be an easy way to change this
to the drop-down menu instead.

There exist a question about this issue on Emacs Stack Exchange site:
https://emacs.stackexchange.com/questions/50478/replace-clicking-a-menu-bar-option-from-m-to-f10-behavior
The proposed "solution" there is similar to this:

(define-key global-map [menu-bar mouse-1]
            (lambda (event)
              (interactive "e")
              ;; Adapted from the implementation of "menu-bar-open" in
Emacs 25.2.2.
              (let* ((x (car (posn-x-y (event-start event))))
                     (menu (menu-bar-menu-at-x-y x 0)))
                (popup-menu (or (lookup-key-ignore-too-long global-map
(vector 'menu-bar menu))
                                (lookup-key-ignore-too-long
(current-local-map) (vector 'menu-bar menu))
                                (cdar (minor-mode-key-binding (vector
'menu-bar menu)))
                                (mouse-menu-bar-map))
                            (posn-at-x-y x 0 nil t)
                            nil
                            t))))

However, there are serious flaws with this "solution":

  * Clicking on a menu bar item (e.g. "Help"), followed immediately by
    clicking outside the menus and drop-downs (e.g. clicking in the
    window) will not cancel the selected action. Instead, the
    highlighted action will actually run.
  * Clicking on a particular menu bar item (e.g. "Help") and immediately
    clicking on it again will not close the drop-down menu.

(Emacs version: 25.2.2, Terminal: GNOME Terminal 3.28.2, OS: Ubuntu 18.04)


[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45820; Package emacs. (Tue, 12 Jan 2021 18:10:02 GMT) Full text and rfc822 format available.

Message #8 received at 45820 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tim Lee <progscriptclone <at> gmail.com>
Cc: 45820 <at> debbugs.gnu.org
Subject: Re: bug#45820: menu-bar-mode: show drop-down menu instead of
 tmm-menubar in terminal Emacs
Date: Tue, 12 Jan 2021 20:09:10 +0200
> From: Tim Lee <progscriptclone <at> gmail.com>
> Date: Tue, 12 Jan 2021 23:30:31 +0800
> 
> The problem: In terminal Emacs, clicking on an item in the menu bar will open "tmm-menubar".

Which terminal is that, and what kind of mouse support does it use?
If you are using xt-mouse, then what you want is already implemented
in what will become the next major release, Emacs 28.

If you are using some other mouse support, please describe that.

> However, there are serious flaws with this "solution":

Yes, they were all recently fixed for xt-mouse.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45820; Package emacs. (Wed, 13 Jan 2021 08:20:02 GMT) Full text and rfc822 format available.

Message #11 received at 45820 <at> debbugs.gnu.org (full text, mbox):

From: Tim Lee <progscriptclone <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 45820 <at> debbugs.gnu.org
Subject: Re: bug#45820: menu-bar-mode: show drop-down menu instead of
 tmm-menubar in terminal Emacs
Date: Wed, 13 Jan 2021 13:11:02 +0800
> Which terminal is that, and what kind of mouse support does it use?

Terminal: GNOME Terminal 3.28.2 on Ubuntu 18.04.

Mouse support: (xterm-mouse-mode t)

> If you are using xt-mouse, then what you want is already implemented
> in what will become the next major release, Emacs 28.

Yes, I am using xt-mouse. Thank you for the information about Emacs 28.

By "what you want is already implemented", do you mean that Emacs 28's
menu bar will show the drop-down menu when clicked, or would I still
need to add "(define-key global-map [menu-bar mouse-1] ...)" to my Emacs
configuration file?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45820; Package emacs. (Wed, 13 Jan 2021 14:29:01 GMT) Full text and rfc822 format available.

Message #14 received at 45820 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tim Lee <progscriptclone <at> gmail.com>
Cc: 45820 <at> debbugs.gnu.org
Subject: Re: bug#45820: menu-bar-mode: show drop-down menu instead of
 tmm-menubar in terminal Emacs
Date: Wed, 13 Jan 2021 16:28:06 +0200
> From: Tim Lee <progscriptclone <at> gmail.com>
> Cc: 45820 <at> debbugs.gnu.org
> Date: Wed, 13 Jan 2021 13:11:02 +0800
> 
> Yes, I am using xt-mouse. Thank you for the information about Emacs 28.
> 
> By "what you want is already implemented", do you mean that Emacs 28's
> menu bar will show the drop-down menu when clicked, or would I still
> need to add "(define-key global-map [menu-bar mouse-1] ...)" to my Emacs
> configuration file?

The former: it works as you expect without any need to tinker.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45820; Package emacs. (Tue, 19 Jan 2021 06:53:02 GMT) Full text and rfc822 format available.

Message #17 received at 45820 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Tim Lee <progscriptclone <at> gmail.com>, 45820 <at> debbugs.gnu.org
Subject: Re: bug#45820: menu-bar-mode: show drop-down menu instead of
 tmm-menubar in terminal Emacs
Date: Tue, 19 Jan 2021 07:52:45 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Yes, I am using xt-mouse. Thank you for the information about Emacs 28.
>> 
>> By "what you want is already implemented", do you mean that Emacs 28's
>> menu bar will show the drop-down menu when clicked, or would I still
>> need to add "(define-key global-map [menu-bar mouse-1] ...)" to my Emacs
>> configuration file?
>
> The former: it works as you expect without any need to tinker.

Then I guess there's nothing more here to be done, and I'm closing this
bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 45820 <at> debbugs.gnu.org and Tim Lee <progscriptclone <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 19 Jan 2021 06:53:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 16 Feb 2021 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 70 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.