diff options
| author | Kim F. Storm | 2005-12-08 14:12:12 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2005-12-08 14:12:12 +0000 |
| commit | 186bccc366fb587be86437cf8f60c347b9f28241 (patch) | |
| tree | 68466b67154517fd7b440f6644febc41c5e8fd30 | |
| parent | 3dd63dc3231c8adc6864855485f168a329fb2ef2 (diff) | |
| download | emacs-186bccc366fb587be86437cf8f60c347b9f28241.tar.gz emacs-186bccc366fb587be86437cf8f60c347b9f28241.zip | |
(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.
| -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." | |||
| 1232 | (not cua--prefix-override-timer))) | 1232 | (not cua--prefix-override-timer))) |
| 1233 | (setq cua--ena-prefix-repeat-keymap | 1233 | (setq cua--ena-prefix-repeat-keymap |
| 1234 | (and cua--ena-region-keymap | 1234 | (and cua--ena-region-keymap |
| 1235 | (timerp cua--prefix-override-timer))) | 1235 | (or (timerp cua--prefix-override-timer) |
| 1236 | (eq cua--prefix-override-timer 'shift)))) | ||
| 1236 | (setq cua--ena-cua-keys-keymap | 1237 | (setq cua--ena-cua-keys-keymap |
| 1237 | (and cua-enable-cua-keys | 1238 | (and cua-enable-cua-keys |
| 1238 | (not cua-inhibit-cua-keys) | 1239 | (not cua-inhibit-cua-keys) |
| @@ -1244,6 +1245,26 @@ If ARG is the atom `-', scroll upward by nearly full screen." | |||
| 1244 | 1245 | ||
| 1245 | (defvar cua--keymaps-initalized nil) | 1246 | (defvar cua--keymaps-initalized nil) |
| 1246 | 1247 | ||
| 1248 | (defun cua--shift-control-prefix (prefix arg) | ||
| 1249 | ;; handle S-C-x and S-C-c by emulating the fast double prefix function. | ||
| 1250 | ;; Don't record this command | ||
| 1251 | (setq this-command last-command) | ||
| 1252 | ;; Restore the prefix arg | ||
| 1253 | (setq prefix-arg arg) | ||
| 1254 | (reset-this-command-lengths) | ||
| 1255 | ;; Activate the cua--prefix-repeat-keymap | ||
| 1256 | (setq cua--prefix-override-timer 'shift) | ||
| 1257 | ;; Push duplicate keys back on the event queue | ||
| 1258 | (setq unread-command-events (cons prefix (cons prefix unread-command-events)))) | ||
| 1259 | |||
| 1260 | (defun cua--shift-control-c-prefix (arg) | ||
| 1261 | (interactive "P") | ||
| 1262 | (cua--shift-control-prefix ?\C-c arg)) | ||
| 1263 | |||
| 1264 | (defun cua--shift-control-x-prefix (arg) | ||
| 1265 | (interactive "P") | ||
| 1266 | (cua--shift-control-prefix ?\C-x arg)) | ||
| 1267 | |||
| 1247 | (defun cua--init-keymaps () | 1268 | (defun cua--init-keymaps () |
| 1248 | (unless (eq cua-use-hyper-key 'only) | 1269 | (unless (eq cua-use-hyper-key 'only) |
| 1249 | (define-key cua-global-keymap [(control return)] 'cua-set-rectangle-mark)) | 1270 | (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." | |||
| 1287 | (define-key cua--prefix-repeat-keymap [(control c) right] 'cua--prefix-copy-handler) | 1308 | (define-key cua--prefix-repeat-keymap [(control c) right] 'cua--prefix-copy-handler) |
| 1288 | 1309 | ||
| 1289 | ;; Enable shifted fallbacks for C-x and C-c when region is active | 1310 | ;; Enable shifted fallbacks for C-x and C-c when region is active |
| 1290 | (define-key cua--region-keymap [(shift control x)] 'Control-X-prefix) | 1311 | (define-key cua--region-keymap [(shift control x)] 'cua--shift-control-x-prefix) |
| 1291 | (define-key cua--region-keymap [(shift control c)] 'mode-specific-command-prefix) | 1312 | (define-key cua--region-keymap [(shift control c)] 'cua--shift-control-c-prefix) |
| 1313 | |||
| 1292 | ;; replace current region | 1314 | ;; replace current region |
| 1293 | (define-key cua--region-keymap [remap self-insert-command] 'cua-replace-region) | 1315 | (define-key cua--region-keymap [remap self-insert-command] 'cua-replace-region) |
| 1294 | (define-key cua--region-keymap [remap self-insert-iso] 'cua-replace-region) | 1316 | (define-key cua--region-keymap [remap self-insert-iso] 'cua-replace-region) |