From: Jim Porter <jporterbugs@gmail.com>
To: 52286@debbugs.gnu.org
Subject: bug#52286: 28.0.90; [PATCH] Be consistent in naming of separators in context menu
Date: Sat, 4 Dec 2021 13:57:31 -0800 [thread overview]
Message-ID: <7a7d6b5c-ff5e-3d55-bef4-8ce8e163abdb@gmail.com> (raw)
[-- 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
next reply other threads:[~2021-12-04 21:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-04 21:57 Jim Porter [this message]
2021-12-05 6:45 ` bug#52286: 28.0.90; [PATCH] Be consistent in naming of separators in context menu 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7a7d6b5c-ff5e-3d55-bef4-8ce8e163abdb@gmail.com \
--to=jporterbugs@gmail.com \
--cc=52286@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.