Subject: bug#52286: 28.0.90; [PATCH] Be consistent in naming of separators in context menu

From: Jim Porter <[email-masked]>
Date: Sat, 4 Dec 2021 13:57:31 -0800

This is spun off from bug#52237[1]. There's a minor issue with 
`context-menu-mode' where some of the separators are named 
`FOO-separator' and others are named `separator-FOO'. Since these 
separators are partially useful for context menu functions to find the 
right place to insert their items, this inconsistency could be pretty 
confusing for authors of those functions (e.g. in third-party packages).

This patch renames the separators to `FOO-separator' following the logic 
in the above-linked comment (in short, `FOO' is a noun adjunct modifying 
the actual object: a separator). To verify that I changed all the 
appropriate places and didn't miss anything, I ran the following command 
and manually looked over all the results to eliminate false positives:

   ag '(?<![\w-])separator-+[A-Za-z][\w-]*' ../lisp -G '.*\.el$'

I've tested the patch on both Emacs 28 and 29 and don't see any issues 
in either.

Hopefully this is a small enough change to make it into Emacs 28, since 
otherwise I think we'd just have to live with the names as they are 
forever. It wouldn't be very nice to change these names after third 
parties had come to rely on them in Emacs 28, after all.

[1] https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-12/msg00312.html
From 30ff30e766a226d3eaec647525a46906f3e1aa9f Mon Sep 17 00:00:00 2001
From: Jim Porter <[email-masked]>
Date: Sat, 4 Dec 2021 13:16:56 -0800
Subject: [PATCH] Rename context menu separators to 'FOO-separator' for
 consistency

* lisp/mouse.el (context-menu-toolbar, context-menu-global)
(context-menu-local, context-menu-minor, context-menu-buffers)
(context-menu-vc, context-menu-undo, context-menu-region): Rename
separators to 'FOO-separator'.
---
 lisp/mouse.el | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lisp/mouse.el b/lisp/mouse.el
index b5ca80a446..ca58dff47f 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -357,7 +357,7 @@ context-menu-middle-separator
 (defun context-menu-toolbar (menu _click)
   "Populate MENU with submenus from the tool bar."
   (run-hooks 'activate-menubar-hook 'menu-bar-update-hook)
-  (define-key-after menu [separator-toolbar] menu-bar-separator)
+  (define-key-after menu [toolbar-separator] menu-bar-separator)
   (map-keymap (lambda (key binding)
                 (when (consp binding)
                   (define-key-after menu (vector key)
@@ -368,7 +368,7 @@ context-menu-toolbar
 (defun context-menu-global (menu _click)
   "Populate MENU with submenus from the global menu."
   (run-hooks 'activate-menubar-hook 'menu-bar-update-hook)
-  (define-key-after menu [separator-global] menu-bar-separator)
+  (define-key-after menu [global-separator] menu-bar-separator)
   (map-keymap (lambda (key binding)
                 (when (consp binding)
                   (define-key-after menu (vector key)
@@ -379,7 +379,7 @@ context-menu-global
 (defun context-menu-local (menu _click)
   "Populate MENU with submenus provided by major mode."
   (run-hooks 'activate-menubar-hook 'menu-bar-update-hook)
-  (define-key-after menu [separator-local] menu-bar-separator)
+  (define-key-after menu [local-separator] menu-bar-separator)
   (let ((keymap (local-key-binding [menu-bar])))
     (when keymap
       (map-keymap (lambda (key binding)
@@ -392,7 +392,7 @@ context-menu-local
 (defun context-menu-minor (menu _click)
   "Populate MENU with submenus provided by minor modes."
   (run-hooks 'activate-menubar-hook 'menu-bar-update-hook)
-  (define-key-after menu [separator-minor] menu-bar-separator)
+  (define-key-after menu [minor-separator] menu-bar-separator)
   (dolist (mode (reverse (minor-mode-key-binding [menu-bar])))
     (when (and (consp mode) (symbol-value (car mode)))
       (map-keymap (lambda (key binding)
@@ -405,7 +405,7 @@ context-menu-minor
 (defun context-menu-buffers (menu _click)
   "Populate MENU with the buffer submenus to buffer switching."
   (run-hooks 'activate-menubar-hook 'menu-bar-update-hook)
-  (define-key-after menu [separator-buffers] menu-bar-separator)
+  (define-key-after menu [buffers-separator] menu-bar-separator)
   (map-keymap (lambda (key binding)
                 (when (consp binding)
                   (define-key-after menu (vector key)
@@ -415,13 +415,13 @@ context-menu-buffers
 
 (defun context-menu-vc (menu _click)
   "Populate MENU with Version Control commands."
-  (define-key-after menu [separator-vc] menu-bar-separator)
+  (define-key-after menu [vc-separator] menu-bar-separator)
   (define-key-after menu [vc-menu] vc-menu-entry)
   menu)
 
 (defun context-menu-undo (menu _click)
   "Populate MENU with undo commands."
-  (define-key-after menu [separator-undo] menu-bar-separator)
+  (define-key-after menu [undo-separator] menu-bar-separator)
   (when (and (not buffer-read-only)
              (not (eq t buffer-undo-list))
              (if (eq last-command 'undo)
@@ -439,7 +439,7 @@ context-menu-undo
 
 (defun context-menu-region (menu click)
   "Populate MENU with region commands."
-  (define-key-after menu [separator-region] menu-bar-separator)
+  (define-key-after menu [region-separator] menu-bar-separator)
   (when (and mark-active (not buffer-read-only))
     (define-key-after menu [cut]
       '(menu-item "Cut" kill-region
-- 
2.25.1