From: Siyuan Chen <chansey97@gmail.com>
To: 71230@debbugs.gnu.org
Subject: bug#71230: [PATCH] Fix C-x C-c do not work in CUA-mode when cua-prefix-override-handler is ni
Date: Tue, 28 May 2024 01:00:40 +0800 [thread overview]
Message-ID: <CAHWTsYmYnORAOGtKyDehcr=QS0qVv5K_JHCD8wW1K93vqvCXYw@mail.gmail.com> (raw)
[-- 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
reply other threads:[~2024-05-27 17:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAHWTsYmYnORAOGtKyDehcr=QS0qVv5K_JHCD8wW1K93vqvCXYw@mail.gmail.com' \
--to=chansey97@gmail.com \
--cc=71230@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 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).