summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-10-11 13:17:38 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-10-11 13:17:38 +0200
commit932c23f7978cf5e94ed9b6df4969b393f7551716 (patch)
tree8744c95418386cb35630a29f1c3d2fbbfea3fecc
parent237b2ecf2d1140d6789822c5de90f9bf2a8ce50c (diff)
downloademacs-932c23f7978cf5e94ed9b6df4969b393f7551716.tar.gz
Fix menu display of keys when cua-mode is active
* lisp/menu-bar.el (menu-bar-edit-menu): Make the menus display the correct keys for editing when cua-mode is active (bug#28930).
-rw-r--r--lisp/menu-bar.el23
1 files changed, 18 insertions, 5 deletions
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 40a1730637d..7c9fc1aeba0 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -514,7 +514,11 @@
(cdr yank-menu)
kill-ring))
(not buffer-read-only))))
- :help "Paste (yank) text most recently cut/copied"))
+ :help "Paste (yank) text most recently cut/copied"
+ :keys (lambda ()
+ (if cua-mode
+ "\\[cua-paste]"
+ "\\[yank]"))))
(bindings--define-key menu [copy]
;; ns-win.el said: Substitute a Copy function that works better
;; under X (for GNUstep).
@@ -523,14 +527,23 @@
'kill-ring-save)
:enable mark-active
:help "Copy text in region between mark and current position"
- :keys ,(if (featurep 'ns)
- "\\[ns-copy-including-secondary]"
- "\\[kill-ring-save]")))
+ :keys (lambda ()
+ (cond
+ ((featurep 'ns)
+ "\\[ns-copy-including-secondary]")
+ ((and cua-mode mark-active)
+ "\\[cua-copy-handler]")
+ (t
+ "\\[kill-ring-save]")))))
(bindings--define-key menu [cut]
'(menu-item "Cut" kill-region
:enable (and mark-active (not buffer-read-only))
:help
- "Cut (kill) text in region between mark and current position"))
+ "Cut (kill) text in region between mark and current position"
+ :keys (lambda ()
+ (if (and cua-mode mark-active)
+ "\\[cua-cut-handler]"
+ "\\[kill-region]"))))
;; ns-win.el said: Separate undo from cut/paste section.
(if (featurep 'ns)
(bindings--define-key menu [separator-undo] menu-bar-separator))