bug-gnu-emacs
[Top][All Lists]
Advanced

[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: Jim Porter
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.





reply via email to

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