comparison lisp/emulation/cua-base.el @ 92353:0e428efff426

(cua-remap-control-v) (cua-remap-control-z): New defcustoms. (cua-mode): Add them to set-after property. (cua--init-keymaps): Use them. Add C-x/C-c home, end, next, and prior to cua--prefix-repeat-keymap.
author Kim F. Storm <storm@cua.dk>
date Fri, 29 Feb 2008 23:43:10 +0000
parents 107ccd98fa12
children 1cefa72f56f5
comparison
equal deleted inserted replaced
92352:1fba6863439b 92353:0e428efff426
278 a shifted movement key. If the value is nil, these keys are never 278 a shifted movement key. If the value is nil, these keys are never
279 enabled." 279 enabled."
280 :type '(choice (const :tag "Disabled" nil) 280 :type '(choice (const :tag "Disabled" nil)
281 (const :tag "Shift region only" shift) 281 (const :tag "Shift region only" shift)
282 (other :tag "Enabled" t)) 282 (other :tag "Enabled" t))
283 :group 'cua)
284
285 (defcustom cua-remap-control-v t
286 "*If non-nil, C-v binding is used for paste (yank).
287 Also, M-v is mapped to `cua-repeat-replace-region'."
288 :type 'boolean
289 :group 'cua)
290
291 (defcustom cua-remap-control-z t
292 "*If non-nil, C-v binding is used for undo."
293 :type 'boolean
283 :group 'cua) 294 :group 'cua)
284 295
285 (defcustom cua-highlight-region-shift-only nil 296 (defcustom cua-highlight-region-shift-only nil
286 "*If non-nil, only highlight region if marked with S-<move>. 297 "*If non-nil, only highlight region if marked with S-<move>.
287 When this is non-nil, CUA toggles `transient-mark-mode' on when the region 298 When this is non-nil, CUA toggles `transient-mark-mode' on when the region
1430 (define-key cua-global-keymap [remap scroll-up] 'cua-scroll-up) 1441 (define-key cua-global-keymap [remap scroll-up] 'cua-scroll-up)
1431 (define-key cua-global-keymap [remap scroll-down] 'cua-scroll-down) 1442 (define-key cua-global-keymap [remap scroll-down] 'cua-scroll-down)
1432 1443
1433 (define-key cua--cua-keys-keymap [(control x) timeout] 'kill-region) 1444 (define-key cua--cua-keys-keymap [(control x) timeout] 'kill-region)
1434 (define-key cua--cua-keys-keymap [(control c) timeout] 'copy-region-as-kill) 1445 (define-key cua--cua-keys-keymap [(control c) timeout] 'copy-region-as-kill)
1435 (define-key cua--cua-keys-keymap [(control z)] 'undo) 1446 (when cua-remap-control-z
1436 (define-key cua--cua-keys-keymap [(control v)] 'yank) 1447 (define-key cua--cua-keys-keymap [(control z)] 'undo))
1437 (define-key cua--cua-keys-keymap [(meta v)] 'cua-repeat-replace-region) 1448 (when cua-remap-control-v
1449 (define-key cua--cua-keys-keymap [(control v)] 'yank)
1450 (define-key cua--cua-keys-keymap [(meta v)] 'cua-repeat-replace-region))
1438 (define-key cua--cua-keys-keymap [remap exchange-point-and-mark] 'cua-exchange-point-and-mark) 1451 (define-key cua--cua-keys-keymap [remap exchange-point-and-mark] 'cua-exchange-point-and-mark)
1439 1452
1440 (define-key cua--prefix-override-keymap [(control x)] 'cua--prefix-override-handler) 1453 (define-key cua--prefix-override-keymap [(control x)] 'cua--prefix-override-handler)
1441 (define-key cua--prefix-override-keymap [(control c)] 'cua--prefix-override-handler) 1454 (define-key cua--prefix-override-keymap [(control c)] 'cua--prefix-override-handler)
1442 1455
1443 (define-key cua--prefix-repeat-keymap [(control x) (control x)] 'cua--prefix-repeat-handler) 1456 (define-key cua--prefix-repeat-keymap [(control x) (control x)] 'cua--prefix-repeat-handler)
1444 (define-key cua--prefix-repeat-keymap [(control x) up] 'cua--prefix-cut-handler)
1445 (define-key cua--prefix-repeat-keymap [(control x) down] 'cua--prefix-cut-handler)
1446 (define-key cua--prefix-repeat-keymap [(control x) left] 'cua--prefix-cut-handler)
1447 (define-key cua--prefix-repeat-keymap [(control x) right] 'cua--prefix-cut-handler)
1448 (define-key cua--prefix-repeat-keymap [(control c) (control c)] 'cua--prefix-repeat-handler) 1457 (define-key cua--prefix-repeat-keymap [(control c) (control c)] 'cua--prefix-repeat-handler)
1449 (define-key cua--prefix-repeat-keymap [(control c) up] 'cua--prefix-copy-handler) 1458 (dolist (key '(up down left right home end next prior))
1450 (define-key cua--prefix-repeat-keymap [(control c) down] 'cua--prefix-copy-handler) 1459 (define-key cua--prefix-repeat-keymap (vector '(control x) key) 'cua--prefix-cut-handler)
1451 (define-key cua--prefix-repeat-keymap [(control c) left] 'cua--prefix-copy-handler) 1460 (define-key cua--prefix-repeat-keymap (vector '(control c) key) 'cua--prefix-copy-handler))
1452 (define-key cua--prefix-repeat-keymap [(control c) right] 'cua--prefix-copy-handler)
1453 1461
1454 ;; Enable shifted fallbacks for C-x and C-c when region is active 1462 ;; Enable shifted fallbacks for C-x and C-c when region is active
1455 (define-key cua--region-keymap [(shift control x)] 'cua--shift-control-x-prefix) 1463 (define-key cua--region-keymap [(shift control x)] 'cua--shift-control-x-prefix)
1456 (define-key cua--region-keymap [(shift control c)] 'cua--shift-control-c-prefix) 1464 (define-key cua--region-keymap [(shift control c)] 'cua--shift-control-c-prefix)
1457 1465
1535 only want to highlight the region when it is selected using a 1543 only want to highlight the region when it is selected using a
1536 shifted movement key, set `cua-highlight-region-shift-only'." 1544 shifted movement key, set `cua-highlight-region-shift-only'."
1537 :global t 1545 :global t
1538 :group 'cua 1546 :group 'cua
1539 :set-after '(cua-enable-modeline-indications 1547 :set-after '(cua-enable-modeline-indications
1548 cua-remap-control-v cua-remap-control-z
1540 cua-rectangle-mark-key cua-rectangle-modifier-key) 1549 cua-rectangle-mark-key cua-rectangle-modifier-key)
1541 :require 'cua-base 1550 :require 'cua-base
1542 :link '(emacs-commentary-link "cua-base.el") 1551 :link '(emacs-commentary-link "cua-base.el")
1543 (setq mark-even-if-inactive t) 1552 (setq mark-even-if-inactive t)
1544 (setq highlight-nonselected-windows nil) 1553 (setq highlight-nonselected-windows nil)