Subject: Re: bug#52237: 29.0.50; [PATCH] Doubled separators in context-menu-mode

From: Jim Porter <[email-masked]>
Date: Thu, 2 Dec 2021 10:47:06 -0800

On 12/1/2021 10:06 PM, Jim Porter wrote:
> Sometimes, menu separators are doubled up in context-menu-mode.

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 "--")
    ...)

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...

[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?