[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#52293: 29.0.50; [PATCH] Prevent further cases of duplicated separato
From: |
Juri Linkov |
Subject: |
bug#52293: 29.0.50; [PATCH] Prevent further cases of duplicated separators in context menus |
Date: |
Mon, 06 Dec 2021 11:23:59 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) |
> On 12/5/2021 9:59 AM, Juri Linkov wrote:
>>> (defun help-mode-context-menu (menu click)
>>> "Populate MENU with Help mode commands at CLICK."
>>> - (define-key menu [help-mode-separator] menu-bar-separator)
>>> + (define-key-after menu [help-mode-separator] menu-bar-separator
>>> + 'top-separator)
>> Now I realized that it's possible to do the same without 'top-separator':
>> (define-key-after menu [help-mode-separator] menu-bar-separator
>> "Context Menu")
>> Or when the title string is defined as a variable:
>> (defvar context-menu-title "Context Menu")
>> (define-key-after menu [help-mode-separator] menu-bar-separator
>> context-menu-title)
>> But maybe 'top-separator' still could be used for clarity?
>> Or it increases complexity?
>
> Hmm, that might work. One downside is that I think it makes it harder for
> context menu functions to change the menu's title/prompt to something
> else. Of course, if we used `context-menu-title' as the anchor like your
> example above, it should still be possible to update the menu title via
> `context-menu-filter-function'. That would be trickier to use though, at
> least in the situations I have in mind.
I agree that relying on the constant value of the menu title
would be too unreliable.
> For example, I added a very limited context menu that uses the menu title
> in my config under Emacs 27 for org-mode links: I can right-click and it
> shows a context menu with the URL as the title and menu items for different
> ways to open the URL (in Firefox, Firefox Private Browsing, or EWW). It's
> nice to be able to see the URL since that can influence which item
> I choose.
Good example. Another example is flyspell that shows a misspelled word
in the menu title.
> Updating this part of my config for Emacs 28 was actually what prompted me
> to start looking into `context-menu-mode' in more detail. It would be
> easier to implement this if context menu functions didn't rely on the
> context menu title having a particular value.
I think the remaining problem we have to solve is to try to
prevent such a situation when the user accidentally removes
`context-menu-top-separator' from `context-menu-functions'.
To not break the menu in this case, maybe we need to ensure
that the menu always contains `top-separator' as well as
`middle-separator' even when `context-menu-functions'
doesn't contain a function that adds them? I.e. just to check
if these separators are missing, and add them at the top.
- bug#52293: 29.0.50; [PATCH] Prevent further cases of duplicated separators in context menus, Jim Porter, 2021/12/05
- bug#52293: 29.0.50; [PATCH] Prevent further cases of duplicated separators in context menus, Juri Linkov, 2021/12/05
- bug#52293: 29.0.50; [PATCH] Prevent further cases of duplicated separators in context menus, Juri Linkov, 2021/12/05
- bug#52293: 29.0.50; [PATCH] Prevent further cases of duplicated separators in context menus, Jim Porter, 2021/12/05
- bug#52293: 29.0.50; [PATCH] Prevent further cases of duplicated separators in context menus,
Juri Linkov <=
- bug#52293: 29.0.50; [PATCH v2] Prevent further cases of duplicated separators in context menus, Jim Porter, 2021/12/06
- bug#52293: 29.0.50; [PATCH v2] Prevent further cases of duplicated separators in context menus, Juri Linkov, 2021/12/07
- bug#52293: 29.0.50; [PATCH v3] Prevent further cases of duplicated separators in context menus, Jim Porter, 2021/12/07
- bug#52293: 29.0.50; [PATCH v3] Prevent further cases of duplicated separators in context menus, Eli Zaretskii, 2021/12/08
- bug#52293: 29.0.50; [PATCH v3] Prevent further cases of duplicated separators in context menus, Jim Porter, 2021/12/08
- bug#52293: 29.0.50; [PATCH v3] Prevent further cases of duplicated separators in context menus, Juri Linkov, 2021/12/08
- bug#52293: 29.0.50; [PATCH v3] Prevent further cases of duplicated separators in context menus, Eli Zaretskii, 2021/12/08
- bug#52293: 29.0.50; [PATCH v3] Prevent further cases of duplicated separators in context menus, Juri Linkov, 2021/12/09
- bug#52293: 29.0.50; [PATCH v3] Prevent further cases of duplicated separators in context menus, Eli Zaretskii, 2021/12/09
- bug#52293: 29.0.50; [PATCH v3] Prevent further cases of duplicated separators in context menus, Jim Porter, 2021/12/11