[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#50552: 28.0.50; Add context-menu-occur
From: |
Juri Linkov |
Subject: |
bug#50552: 28.0.50; Add context-menu-occur |
Date: |
Sat, 02 Oct 2021 22:25:10 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) |
>>> The reasoning was the following: by default, dictionary.el is not loaded,
>>> so its context menu item is not used. But when the user wants to use
>>> dictionary.el and explicitly loads it, then automatically provide also
>>> its context menu item.
>>
>> On this topic, I am not sure how good it is to do this
>> automatically. One effect seems to be that context-menu-dictionary
>> inserts itself at an unintended place in the menu (in my case as the
>> first item, even though I'd prefer it to be further down).
>
> It turns out the issue here is that context-menu-dictionary uses
> define-key instead of define-key-after. Here is a patch to fix it:
To make the context menus in Emacs more in line with other apps
the design principles were the following:
1. When a context function can detect context with 100% reliability
that usually achieved by using e.g. text properties on short stretches
of the buffer like links in eww and Info manuals, or file names in Dired,
then corresponding menu items are placed at the top of the context menus,
like link-related items are placed first in web browsers, e.g. "Open link",
"Save link", etc.
2. After such items comes Undo/Redo and the region-related submenu.
3. When the context around the mouse click is not 100% bound to the action,
then it's placed further down from the above items. So such items as
"Look up in Manual" and "Find Definition" are placed below since
they are activated on every word in the buffer, even on such words
that are not valid program symbols.
4. The last items (major/minor mode menus) replicate the order of items
from the menu-bar.
So according to this design, you are right that context-menu-dictionary
should be more below. And it should be placed to the position 3
that has the special marker named 'middle-separator'. Now fixed, thanks
for the suggestion.