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 v2] Prevent further cases of duplicated separators in context menus
Date: Mon, 6 Dec 2021 19:54:11 -0800
[Message part 1 (text/plain, inline)]
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?
[0001-Add-a-top-separator-to-the-context-menu.patch (text/plain, attachment)]

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.