GNU bug report logs - #52237
29.0.50; [PATCH] Doubled separators in context-menu-mode

Previous Next

Package: emacs;

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

Date: Thu, 2 Dec 2021 06:07:01 UTC

Severity: normal

Tags: moreinfo, patch

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: 52237 <at> debbugs.gnu.org
Subject: bug#52237: 29.0.50; [PATCH] Doubled separators in context-menu-mode
Date: Sat, 04 Dec 2021 21:50:20 +0200
> I found another odd case, but I'm not 100% sure the best way to fix it:
>
>   emacs -Q --eval '(context-menu-mode)'
>   C-h o identity RET
>   ;; Right-click somewhere in the Help buffer
>
> There's a doubled separator after "Next Topic". Looking at the code, this
> is because `help-mode-context-menu' inserts new items using `define-key',
> which has the effect of putting the new items *before* the (hidden) menu
> title. The resulting keymap ends up looking like this:
>
>   (keymap
>    (Previous\ Topic ...)
>    (Next\ Topic ...)
>    (help-mode-separator "--")
>    #("Context Menu" 0 12 (hide t))
>    (separator-undo "--")
>    ...)

The core function that displays the menu can handle
the menu title in the middle of the menu, so it wasn't
a problem until the recent need to remove duplicate items.

> Since there's a hidden item (the keymap title) between the
> `help-mode-separator' and `separator-undo'[1], the de-duplication doesn't
> handle that. Is there a standard/common way of defining a key such that it
> goes immediately *after* the keymap's title? I guess we could add
> `context-menu-top-separator' as an anchor (by analogy to
> `context-menu-middle-separator'), but maybe there's a simpler way...

I see no simpler way, so perhaps we need to add `context-menu-top-separator'.

> [1] As an aside, is there a standard naming convention to use here? Should
> "separator" go at the beginning of the name or the end?

`context-menu-middle-separator' is a function, so it requires the
`context-menu-' prefix.  It adds the menu item [middle-separator].
Since "middle" is an adjective, the word order can't be "separator-middle".
But "buffers-separator" doesn't look nicer than `separator-buffers'.

If you could propose a more consistent naming convention,
maybe it's not too late to rename these symbols on the release branch,
because after the release it will be impossible to rename them.




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

Previous Next


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