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


Message #68 received at 52293 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: Drew Adams <drew.adams <at> oracle.com>, Eli Zaretskii <eliz <at> gnu.org>
Cc: "52293 <at> debbugs.gnu.org" <52293 <at> debbugs.gnu.org>,
 "juri <at> linkov.net" <juri <at> linkov.net>
Subject: Re: bug#52293: [External] : bug#52293: 29.0.50; [PATCH v3] Prevent
 further cases of duplicated separators in context menus
Date: Sun, 12 Dec 2021 14:12:16 -0800
On 12/12/2021 1:00 PM, Drew Adams wrote:
> Caveat: I'm not following this thread.  FWIW:
> 
> 1. In my code I have _lots_ of menu separators that
> are apparently in what you call the old naming
> convention.

That's fine. I'd prefer we *not* update old menu separators, since 
that's a compatibility break. The only exception would be for existing 
context menu separators, since they're pretty new anyway, so the chance 
of any code relying on the old context menu names is low.

> 3. I think there's zero need for any naming
>     convention for menu-item names, whether
>     separators or other.

The goal was to make it easier to remember the names of the separators 
if you wanted to add a new item after a particular separator that had 
already been added. It's easier to remember if they're all 
`foo-separator' instead of a mix of styles.

> 4. As I stated early on in this thread, I think
>     it's misguided to prevent the use of duplicate
>     separators.  If someone wants such duplicates
>     for some reason (and there can be any number
>     of reasons), let them be.  And if someone, for
>     some reason, wants to prevent such duplicates
>     they can do so easily enough, manually or by
>     code.

Technically, this is already possible by using extended-format menu 
items. Only simple separators are de-duplicated. So this would be 
de-duplicated:

  (define-key menu [foo-separator] '("--"))

But this wouldn't:

  (define-key menu [bar-separator] '(menu-item "--"))

That's not documented though, and I'm not sure what promises we should 
make here. It might be better to have a more-explicit way of opting into 
de-duplication, but I'm not sure what that would be off-hand.

It may be possible for context menu functions to be more careful about 
the insertion of separators so that duplicates never crop up in the 
first place. However, that would take a bit of experimentation, and I'm 
not sure of all the pros and cons of a solution like that. Maybe Juri 
has some thoughts on this though.




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

Previous Next


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