all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tim Lee <progscriptclone@gmail.com>
To: 45820@debbugs.gnu.org
Subject: bug#45820: menu-bar-mode: show drop-down menu instead of tmm-menubar in terminal Emacs
Date: Tue, 12 Jan 2021 23:30:31 +0800	[thread overview]
Message-ID: <29733eeb-d5b4-a133-2d44-f844b7768caf@gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2021-01-12 15:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12 15:30 Tim Lee [this message]
2021-01-12 18:09 ` bug#45820: menu-bar-mode: show drop-down menu instead of tmm-menubar in terminal Emacs Eli Zaretskii
2021-01-13  5:11   ` Tim Lee
2021-01-13 14:28     ` Eli Zaretskii
2021-01-19  6:52       ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=29733eeb-d5b4-a133-2d44-f844b7768caf@gmail.com \
    --to=progscriptclone@gmail.com \
    --cc=45820@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.