Subject: bug#52293: 29.0.50; [PATCH] Prevent further cases of duplicated separators in context menus

From: Jim Porter <[email-masked]>
Date: Sun, 5 Dec 2021 20:07:56 -0800

On 12/5/2021 1:39 AM, Juri Linkov wrote:
>> Attached is a patch to fix this based on the discussion in bug#52237.
> 
> Thanks for the patch.
> 
>> One slightly odd thing is that for context menu functions that put their items
>> at the top, they place their separator *below* the items. Other functions
>> place the separator *above* the items.
> 
> There is some logic in this: when the menu doesn't contain a separator
> at the top, then it is necessary to add a separator below the added items,
> e.g. by modifying such a menu:
> 
>    - existing menu item 1
>    - existing menu item 2
> 
> to
> 
>    - new item 1
>    - new item 2
>    - new separator
>    - existing menu item 1
>    - existing menu item 2

Right, makes sense.

(I was originally thinking that we could put items above 
`top-separator', and that then there'd be a separator below the items. 
That's not right though, since we'd use `define-key-after', putting the 
items *below* `top-separator'. There's no `define-key-before', so I just 
had the logic backwards in my head.)