* bug#71230: [PATCH] Fix C-x C-c do not work in CUA-mode when cua-prefix-override-handler is ni
@ 2024-05-27 17:00 Siyuan Chen
0 siblings, 0 replies; only message in thread
From: Siyuan Chen @ 2024-05-27 17:00 UTC (permalink / raw)
To: 71230
[-- Attachment #1.1: Type: text/plain, Size: 492 bytes --]
Currently, cua-mode has a bug i.e. when `(setq
cua-prefix-override-inhibit-delay nil)`, cut and copy do not work.
Also we have to`(setq cua-prefix-override-inhibit-delay nil)`,
otherwise cua-mode will not be able to support fast copy/cut & paste.
More detail information, see emacs-devel
https://lists.gnu.org/archive/html/emacs-devel/2024-05/msg01033.html
P.s. This patch based on the mirror repo
https://github.com/emacs-mirror/emacs
and Tested in Emacs 29.3.
Best regards,
Siyuan Chen
[-- Attachment #1.2: Type: text/html, Size: 735 bytes --]
[-- Attachment #2: 0001-Fix-the-issue-when-cua-prefix-override-handler-is-ni.patch --]
[-- Type: text/plain, Size: 2046 bytes --]
From 006de6c527c02566185ca4f0e5f5e41175882d68 Mon Sep 17 00:00:00 2001
From: Siyuan Chen <chansey97@gmail.com>
Date: Tue, 28 May 2024 00:29:50 +0800
Subject: [PATCH] Fix the issue when cua--prefix-override-handler is nil C-x
C-c doesn't work.
Detail see https://lists.gnu.org/archive/html/emacs-devel/2024-05/msg01033.html
---
lisp/emulation/cua-base.el | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index fb6a8515d9e..cacd348c315 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -699,10 +699,27 @@ Repeating prefix key when region is active works as a single prefix key."
(interactive)
(cua--prefix-override-replay 0))
-;; These aliases are so that we can look up the commands and find the
-;; correct keys when generating menus.
-(defalias 'cua-cut-handler #'cua--prefix-override-handler)
-(defalias 'cua-copy-handler #'cua--prefix-override-handler)
+;; These two functions are so that we can look up the commands and find the
+;; correct keys when generating menus. Also, when cua--prefix-override-handler
+;; is nil, allow C-x C-c to cut/copy immediately without waiting for
+;; cua--prefix-override-timer to expire.
+(defun cua-cut-handler ()
+ (interactive)
+ (if (or (not (numberp cua-prefix-override-inhibit-delay))
+ (<= cua-prefix-override-inhibit-delay 0))
+ (cond
+ (cua--global-mark-active (cua-cut-to-global-mark))
+ (t (call-interactively 'kill-region)))
+ (cua--prefix-override-handler)))
+
+(defun cua-copy-handler ()
+ (interactive)
+ (if (or (not (numberp cua-prefix-override-inhibit-delay))
+ (<= cua-prefix-override-inhibit-delay 0))
+ (cond
+ (cua--global-mark-active (cua-copy-to-global-mark))
+ (t (call-interactively 'copy-region-as-kill)))
+ (cua--prefix-override-handler)))
(defun cua--prefix-repeat-handler ()
"Repeating prefix key when region is active works as a single prefix key."
--
2.32.0.windows.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-27 17:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-27 17:00 bug#71230: [PATCH] Fix C-x C-c do not work in CUA-mode when cua-prefix-override-handler is ni Siyuan Chen
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.