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 v2] Prevent further cases of duplicated separ


From: Jim Porter
Subject: bug#52293: 29.0.50; [PATCH v2] Prevent further cases of duplicated separators in context menus
Date: Mon, 6 Dec 2021 19:54:11 -0800

On 12/6/2021 1:23 AM, Juri Linkov wrote:
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.

For the top separator, maybe instead of providing a function for users to put wherever they like in `context-menu-functions', we could just add it directly in `context-menu-map' immediately before calling the functions in `context-menu-functions'? Since it's supposed to be at the top, it doesn't make a lot of sense to be able to customize where it goes.

It does makes sense to customize where `middle-separator' goes though; what the user considers the "middle" depends on what other menu items are normally present. However, if the user didn't include `context-menu-middle-separator', then

  (define-key-after menu [foo] '(menu-item ...) 'middle-separator)

just adds `foo' to the end of the menu. That seems ok to me. Then, adding after `top-separator' puts your item at the beginning of the menu, and adding after `middle-separator' puts your item at the middle or the end, depending on the user's configuration. How does that sound to you?

Attachment: 0001-Add-a-top-separator-to-the-context-menu.patch
Description: Text document


reply via email to

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