[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tip: tty mode-line popup menus
From: |
Gerd Möllmann |
Subject: |
Re: Tip: tty mode-line popup menus |
Date: |
Tue, 10 Dec 2024 11:09:20 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Gerd Möllmann <gerd.moellmann@gmail.com> writes:
> Gerd Möllmann <gerd.moellmann@gmail.com> writes:
>
>> Stefan Kangas <stefankangas@gmail.com> writes:
>>
>>> Gerd Möllmann <gerd.moellmann@gmail.com> writes:
>>>
>>>> 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)
>>>
>>> How about adding a defcustom for this behavior?
>>
>> Maybe, don't know. One problem is that I don't know where else something
>> similar is done. I know only the two places above plus one in the
>> Minions package, which probably simply mimicked what Emacs does in
>> bindings.el. Or in other words, I don't have enough of an overview to
>> design something that's really useful.
>>
>>> I guess many users are on laptops with trackpads these days, and would
>>> find that convenient.
>>
>> I guess so, especially if they use tap-to-click like I do.
>
> BTW,
>
> (my-fix-mode-line-map mode-line-major-mode-keymap)
>
> in combination with using the persistent-scratch package somehow seems
> to mess up the major-mode mode-line menu. I don't yet understand how, so
> be warned.
Resorting to logic sometimes helps. The problem is pretty simple:
Original definition in mode-line-major-mode-keymap looks like
(down-mouse-1 menu-item "Menu Bar" ignore :filter
#f(compiled-function (_) #<bytecode
Lookup-key does not return that
(lookup-key mode-line-major-mode-keymap (kbd "<mode-line> <down-mouse-1>"))
=> (keymap "IELM Mode" keymap
(keymap
(ielm menu-item "IELM"
(keymap "IELM"
...
And setting that with define-key is not the right thing, obviously. One
would need a function returning the "raw" entry of a key in a keymap,
No idea if Emacs has such a function. If it does, I can't find it.
In essence, I have to retract that tip. It doesn't work as expected.
- Re: Tip: tty mode-line popup menus, (continued)