diff options
author | Kim F. Storm <storm@cua.dk> | 2005-12-08 14:12:12 +0000 |
---|---|---|
committer | Kim F. Storm <storm@cua.dk> | 2005-12-08 14:12:12 +0000 |
commit | 186bccc366fb587be86437cf8f60c347b9f28241 (patch) | |
tree | 68466b67154517fd7b440f6644febc41c5e8fd30 /lisp/emulation | |
parent | 3dd63dc3231c8adc6864855485f168a329fb2ef2 (diff) | |
download | emacs-186bccc366fb587be86437cf8f60c347b9f28241.tar.gz |
(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.
Diffstat (limited to 'lisp/emulation')
-rw-r--r-- | lisp/emulation/cua-base.el | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el index b9ed8166d68..b36e4158c2f 100644 --- a/lisp/emulation/cua-base.el +++ b/lisp/emulation/cua-base.el @@ -1232,7 +1232,8 @@ If ARG is the atom `-', scroll upward by nearly full screen." (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 @@ If ARG is the atom `-', scroll upward by nearly full screen." (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 @@ If ARG is the atom `-', scroll upward by nearly full screen." (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) |