emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Tip: tty mode-line popup menus


From: Gerd Möllmann
Subject: Tip: tty mode-line popup menus
Date: Mon, 09 Dec 2024 09:01:46 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Just a tip I wanted to share. Maybe some tty Emacs user finds it useful.
Couldn't find anything mentioned on the internet.

When clicking on, say, the major mode indicator in the mode-line
different things happen, depending on whether I'm using a GUI or tty
Emacs (-nw):

- GUI (NS In may case): a popup menu opens on down-mpuse-1 and stays
  open when I release the mouse button.

- Tty: a popup menu opens on down-mouse-1 and is closed as soon as I
  release the mouse button. If the mouse is over a menu item[B releasing
  the button also selects the menu item.

I don't like the tty behavior. It is fiddly with a track pad, which I
normally use, leading to inadvertent menu selections. Furthermore,
keyboard operation of the menu seems impossible.

To fix this, I've added this in my init.el:

  (defun my-fix-mode-line-map (map)
    (let* ((down-mouse (kbd "<mode-line> <down-mouse-1>"))
           (mouse (kbd "<mode-line> <mouse-1>"))
           (def (lookup-key map down-mouse)))
      (when def
        (define-key map down-mouse nil)
        (define-key map mouse def))))

  (my-fix-mode-line-map mode-line-major-mode-keymap)
  (my-fix-mode-line-map mode-line-minor-mode-keymap)

Have fun!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]