GNU bug report logs - #52293
29.0.50; [PATCH] Prevent further cases of duplicated separators in context menus

Previous Next

Package: emacs;

Reported by: Jim Porter <jporterbugs <at> gmail.com>

Date: Sun, 5 Dec 2021 05:59:01 UTC

Severity: normal

Tags: patch

Fixed in version 29.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jim Porter <jporterbugs <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: 52293 <at> debbugs.gnu.org
Subject: bug#52293: 29.0.50; [PATCH] Prevent further cases of duplicated separators in context menus
Date: Sun, 5 Dec 2021 20:50:32 -0800
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.

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.

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.




This bug report was last modified 3 years and 136 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.