From: Stefan Kangas Date: Wed, 12 Feb 2025 08:17:37 +0000 (+0100) Subject: ; Fix up last commit X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a9301868db13a355cefe87a165d34d0c77cfe0e9;p=emacs.git ; Fix up last commit * lisp/emulation/cua-base.el (cua--copy-or-cut-handler): Extract function from... (cua-cut-handler, cua-copy-handler): ...here. (cua-cut-to-global-mark, cua-copy-to-global-mark): Declare. (cherry picked from commit 2254f7159813c345021896605be177e43c7ccb6d) --- diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el index 1c21a295e12..c3b09b1f62c 100644 --- a/lisp/emulation/cua-base.el +++ b/lisp/emulation/cua-base.el @@ -703,21 +703,25 @@ Repeating prefix key when region is active works as a single prefix key." ;; 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) +(declare-function cua-cut-to-global-mark "cua-gmrk") +(declare-function cua-copy-to-global-mark "cua-gmrk") +(defun cua--copy-or-cut-handler (&optional cut) (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))) + (cond ((and (bound-and-true-p cua--global-mark-active)) + (funcall (if cut #'cua-cut-to-global-mark + #'cua-copy-to-global-mark))) + (t (call-interactively (if cut #'kill-region + #'copy-region-as-kill)))) (cua--prefix-override-handler))) +(defun cua-cut-handler () + (interactive) + (cua--copy-or-cut-handler t)) + (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))) + (cua--copy-or-cut-handler)) (defun cua--prefix-repeat-handler () "Repeating prefix key when region is active works as a single prefix key."