* bug#45820: menu-bar-mode: show drop-down menu instead of tmm-menubar in terminal Emacs
@ 2021-01-12 15:30 Tim Lee
2021-01-12 18:09 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Tim Lee @ 2021-01-12 15:30 UTC (permalink / raw)
To: 45820
[-- Attachment #1: Type: text/plain, Size: 2385 bytes --]
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)
[-- Attachment #2: Type: text/html, Size: 3055 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#45820: menu-bar-mode: show drop-down menu instead of tmm-menubar in terminal Emacs
2021-01-12 15:30 bug#45820: menu-bar-mode: show drop-down menu instead of tmm-menubar in terminal Emacs Tim Lee
@ 2021-01-12 18:09 ` Eli Zaretskii
2021-01-13 5:11 ` Tim Lee
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2021-01-12 18:09 UTC (permalink / raw)
To: Tim Lee; +Cc: 45820
> From: Tim Lee <progscriptclone@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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#45820: menu-bar-mode: show drop-down menu instead of tmm-menubar in terminal Emacs
2021-01-12 18:09 ` Eli Zaretskii
@ 2021-01-13 5:11 ` Tim Lee
2021-01-13 14:28 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Tim Lee @ 2021-01-13 5:11 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 45820
> 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?
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#45820: menu-bar-mode: show drop-down menu instead of tmm-menubar in terminal Emacs
2021-01-13 5:11 ` Tim Lee
@ 2021-01-13 14:28 ` Eli Zaretskii
2021-01-19 6:52 ` Lars Ingebrigtsen
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2021-01-13 14:28 UTC (permalink / raw)
To: Tim Lee; +Cc: 45820
> From: Tim Lee <progscriptclone@gmail.com>
> Cc: 45820@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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#45820: menu-bar-mode: show drop-down menu instead of tmm-menubar in terminal Emacs
2021-01-13 14:28 ` Eli Zaretskii
@ 2021-01-19 6:52 ` Lars Ingebrigtsen
0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-19 6:52 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Tim Lee, 45820
Eli Zaretskii <eliz@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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-01-19 6:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-12 15:30 bug#45820: menu-bar-mode: show drop-down menu instead of tmm-menubar in terminal Emacs Tim Lee
2021-01-12 18:09 ` Eli Zaretskii
2021-01-13 5:11 ` Tim Lee
2021-01-13 14:28 ` Eli Zaretskii
2021-01-19 6:52 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).