changeset 67385:15ed3778b098

(cua--select-keymaps): Enable repeat keymap if cua--prefix-override-timer equals 'shift. (cua--shift-control-prefix): New function; emulate "type prefix key twice" functionality to handle shifted prefix key override. (cua--shift-control-c-prefix, cua--shift-control-x-prefix): New commands. (cua--init-keymaps): Bind them to S-C-c and S-C-x.
author Kim F. Storm <storm@cua.dk>
date Thu, 08 Dec 2005 14:12:12 +0000
parents 970639b3c537
children d3419a52a937
files lisp/emulation/cua-base.el
diffstat 1 files changed, 25 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emulation/cua-base.el	Thu Dec 08 14:12:01 2005 +0000
+++ b/lisp/emulation/cua-base.el	Thu Dec 08 14:12:12 2005 +0000
@@ -1232,7 +1232,8 @@
 	     (not cua--prefix-override-timer)))
   (setq cua--ena-prefix-repeat-keymap
 	(and cua--ena-region-keymap
-	     (timerp cua--prefix-override-timer)))
+	     (or (timerp cua--prefix-override-timer)
+		 (eq cua--prefix-override-timer 'shift))))
   (setq cua--ena-cua-keys-keymap
 	(and cua-enable-cua-keys
 	     (not cua-inhibit-cua-keys)
@@ -1244,6 +1245,26 @@
 
 (defvar cua--keymaps-initalized nil)
 
+(defun cua--shift-control-prefix (prefix arg)
+  ;; handle S-C-x and S-C-c by emulating the fast double prefix function.
+  ;; Don't record this command
+  (setq this-command last-command)
+  ;; Restore the prefix arg
+  (setq prefix-arg arg)
+  (reset-this-command-lengths)
+  ;; Activate the cua--prefix-repeat-keymap
+  (setq cua--prefix-override-timer 'shift)
+  ;; Push duplicate keys back on the event queue
+  (setq unread-command-events (cons prefix (cons prefix unread-command-events))))
+
+(defun cua--shift-control-c-prefix (arg)
+  (interactive "P")
+  (cua--shift-control-prefix ?\C-c arg))
+
+(defun cua--shift-control-x-prefix (arg)
+  (interactive "P")
+  (cua--shift-control-prefix ?\C-x arg))
+
 (defun cua--init-keymaps ()
   (unless (eq cua-use-hyper-key 'only)
     (define-key cua-global-keymap [(control return)]	'cua-set-rectangle-mark))
@@ -1287,8 +1308,9 @@
   (define-key cua--prefix-repeat-keymap [(control c) right] 'cua--prefix-copy-handler)
 
   ;; Enable shifted fallbacks for C-x and C-c when region is active
-  (define-key cua--region-keymap [(shift control x)] 'Control-X-prefix)
-  (define-key cua--region-keymap [(shift control c)] 'mode-specific-command-prefix)
+  (define-key cua--region-keymap [(shift control x)] 'cua--shift-control-x-prefix)
+  (define-key cua--region-keymap [(shift control c)] 'cua--shift-control-c-prefix)
+
   ;; replace current region
   (define-key cua--region-keymap [remap self-insert-command]	'cua-replace-region)
   (define-key cua--region-keymap [remap self-insert-iso]	'cua-replace-region)