unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#52286: 28.0.90; [PATCH] Be consistent in naming of separators in context menu
@ 2021-12-04 21:57 Jim Porter
  2021-12-05  6:45 ` Eli Zaretskii
  2021-12-05 17:52 ` Juri Linkov
  0 siblings, 2 replies; 14+ messages in thread
From: Jim Porter @ 2021-12-04 21:57 UTC (permalink / raw)
  To: 52286

[-- Attachment #1: Type: text/plain, Size: 1263 bytes --]

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

[-- Attachment #2: 0001-Rename-context-menu-separators-to-FOO-separator-for-.patch --]
[-- Type: text/plain, Size: 4013 bytes --]

From 30ff30e766a226d3eaec647525a46906f3e1aa9f Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
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


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-01-15 19:25 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-04 21:57 bug#52286: 28.0.90; [PATCH] Be consistent in naming of separators in context menu Jim Porter
2021-12-05  6:45 ` Eli Zaretskii
2021-12-05  7:44   ` Jim Porter
2021-12-05 10:39     ` Eli Zaretskii
2021-12-06  2:09       ` Jim Porter
2021-12-06 12:55         ` Eli Zaretskii
2021-12-11 20:52           ` Jim Porter
2022-01-15 18:57             ` Juri Linkov
2022-01-15 19:13               ` Eli Zaretskii
2022-01-15 19:19                 ` Juri Linkov
2022-01-15 19:23                   ` Eli Zaretskii
2022-01-15 19:25                     ` Juri Linkov
2021-12-05  9:37   ` Juri Linkov
2021-12-05 17:52 ` Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).