54 |
;; This probably sounds strange and difficult to get used to - but |
;; This probably sounds strange and difficult to get used to - but |
55 |
;; based on my own experience and the feedback from many users of |
;; based on my own experience and the feedback from many users of |
56 |
;; this package, it actually works very well and users adapt to it |
;; this package, it actually works very well and users adapt to it |
57 |
;; instantly - or at least very quickly. So give it a try! |
;; instantly - or at least very quickly. So give it a try! |
58 |
;; ... and in the few cases where you make a mistake and accidentally |
;; ... and in the few cases where you make a mistake and accidentally |
59 |
;; delete the region - you just undo the mistake (with C-z). |
;; delete the region - you just undo the mistake (with C-z). |
60 |
;; |
;; |
120 |
;; -------------------- |
;; -------------------- |
121 |
;; Emacs' standard register support is also based on a separate set of |
;; Emacs' standard register support is also based on a separate set of |
122 |
;; "register commands". |
;; "register commands". |
123 |
;; |
;; |
124 |
;; CUA's register support is activated by providing a numeric |
;; CUA's register support is activated by providing a numeric |
125 |
;; prefix argument to the C-x, C-c, and C-v commands. For example, |
;; prefix argument to the C-x, C-c, and C-v commands. For example, |
126 |
;; to copy the selected region to register 2, enter [M-2 C-c]. |
;; to copy the selected region to register 2, enter [M-2 C-c]. |
127 |
;; Or if you have activated the keypad prefix mode, enter [kp-2 C-c]. |
;; Or if you have activated the keypad prefix mode, enter [kp-2 C-c]. |
128 |
;; |
;; |
129 |
;; And CUA will copy and paste normal region as well as rectangles |
;; And CUA will copy and paste normal region as well as rectangles |
130 |
;; into the registers, i.e. you use exactly the same command for both. |
;; into the registers, i.e. you use exactly the same command for both. |
131 |
;; |
;; |
132 |
;; In addition, the last highlighted text that is deleted (not |
;; In addition, the last highlighted text that is deleted (not |
133 |
;; copied), e.g. by [delete] or by typing text over a highlighted |
;; copied), e.g. by [delete] or by typing text over a highlighted |
134 |
;; region, is automatically saved in register 0, so you can insert it |
;; region, is automatically saved in register 0, so you can insert it |
140 |
;; between the mark and point as a "virtual rectangle", and using a |
;; between the mark and point as a "virtual rectangle", and using a |
141 |
;; completely separate set of "rectangle commands" [C-x r ...] on the |
;; completely separate set of "rectangle commands" [C-x r ...] on the |
142 |
;; region to copy, kill, fill a.s.o. the virtual rectangle. |
;; region to copy, kill, fill a.s.o. the virtual rectangle. |
143 |
;; |
;; |
144 |
;; cua-mode's superior rectangle support is based on using a true visual |
;; cua-mode's superior rectangle support is based on using a true visual |
145 |
;; representation of the selected rectangle. To start a rectangle, use |
;; representation of the selected rectangle. To start a rectangle, use |
146 |
;; [S-return] and extend it using the normal movement keys (up, down, |
;; [S-return] and extend it using the normal movement keys (up, down, |
154 |
;; the rectangle is inserted into the existing lines in the buffer. |
;; the rectangle is inserted into the existing lines in the buffer. |
155 |
;; If overwrite-mode is active when you paste a rectangle, it is |
;; If overwrite-mode is active when you paste a rectangle, it is |
156 |
;; inserted as normal (multi-line) text. |
;; inserted as normal (multi-line) text. |
157 |
;; |
;; |
158 |
;; Furthermore, cua-mode's rectangles are not limited to the actual |
;; Furthermore, cua-mode's rectangles are not limited to the actual |
159 |
;; contents of the buffer, so if the cursor is currently at the end of a |
;; contents of the buffer, so if the cursor is currently at the end of a |
160 |
;; short line, you can still extend the rectangle to include more columns |
;; short line, you can still extend the rectangle to include more columns |
161 |
;; of longer lines in the same rectangle. Sounds strange? Try it! |
;; of longer lines in the same rectangle. Sounds strange? Try it! |
162 |
;; |
;; |
163 |
;; You can enable padding for just this rectangle by pressing [M-p]; |
;; You can enable padding for just this rectangle by pressing [M-p]; |
164 |
;; this works like entering `picture-mode' where the tabs and spaces |
;; this works like entering `picture-mode' where the tabs and spaces |
165 |
;; are automatically converted/inserted to make the rectangle truly |
;; are automatically converted/inserted to make the rectangle truly |
185 |
;; paragraph like this one, just place the cursor on the first character |
;; paragraph like this one, just place the cursor on the first character |
186 |
;; of the first line, and enter the following: |
;; of the first line, and enter the following: |
187 |
;; S-return M-} ; ; <space> S-return |
;; S-return M-} ; ; <space> S-return |
188 |
|
|
189 |
;; cua-mode's rectangle support also includes all the normal rectangle |
;; cua-mode's rectangle support also includes all the normal rectangle |
190 |
;; functions with easy access: |
;; functions with easy access: |
191 |
;; |
;; |
202 |
;; [M-m] copies the rectangle as normal multi-line text (for paste) |
;; [M-m] copies the rectangle as normal multi-line text (for paste) |
203 |
;; [M-n] fills each line of the rectangle with increasing numbers using |
;; [M-n] fills each line of the rectangle with increasing numbers using |
204 |
;; a supplied format string (prompt) |
;; a supplied format string (prompt) |
205 |
;; [M-o] opens the rectangle by moving the highlighted text to the |
;; [M-o] opens the rectangle by moving the highlighted text to the |
206 |
;; right of the rectangle and filling the rectangle with blanks. |
;; right of the rectangle and filling the rectangle with blanks. |
207 |
;; [M-p] toggles rectangle padding, i.e. insert tabs and spaces to |
;; [M-p] toggles rectangle padding, i.e. insert tabs and spaces to |
208 |
;; make rectangles truly rectangular |
;; make rectangles truly rectangular |
222 |
;; are lost, but can be recovered using [C-z]. |
;; are lost, but can be recovered using [C-z]. |
223 |
|
|
224 |
;; CUA Global Mark |
;; CUA Global Mark |
225 |
;; --------------- |
;; --------------- |
226 |
;; The final feature provided by CUA is the "global mark", which |
;; The final feature provided by CUA is the "global mark", which |
227 |
;; makes it very easy to copy bits and pieces from the same and other |
;; makes it very easy to copy bits and pieces from the same and other |
228 |
;; files into the current text. To enable and cancel the global mark, |
;; files into the current text. To enable and cancel the global mark, |
229 |
;; use [S-C-space]. The cursor will blink when the global mark |
;; use [S-C-space]. The cursor will blink when the global mark |
230 |
;; is active. The following commands behave differently when the global |
;; is active. The following commands behave differently when the global |
231 |
;; mark is set: |
;; mark is set: |
232 |
;; <ch> All characters (including newlines) you type are inserted |
;; <ch> All characters (including newlines) you type are inserted |
233 |
;; at the global mark! |
;; at the global mark! |
234 |
;; [C-x] If you cut a region or rectangle, it is automatically inserted |
;; [C-x] If you cut a region or rectangle, it is automatically inserted |
235 |
;; at the global mark, and the global mark is advanced. |
;; at the global mark, and the global mark is advanced. |
289 |
'shift, these keys are only enabled if the last region was marked with |
'shift, these keys are only enabled if the last region was marked with |
290 |
a shifted movement key. If the value is nil, these keys are never |
a shifted movement key. If the value is nil, these keys are never |
291 |
enabled." |
enabled." |
292 |
:type '(choice (const :tag "Disabled" nil) |
:type '(choice (const :tag "Disabled" nil) |
293 |
(const :tag "Shift region only" shift) |
(const :tag "Shift region only" shift) |
294 |
(other :tag "Enabled" t)) |
(other :tag "Enabled" t)) |
295 |
:group 'cua) |
:group 'cua) |
303 |
:type 'boolean |
:type 'boolean |
304 |
:group 'cua) |
:group 'cua) |
305 |
|
|
306 |
(defcustom cua-prefix-override-inhibit-delay |
(defcustom cua-prefix-override-inhibit-delay |
307 |
(if (featurep 'lisp-float-type) (/ (float 1) (float 5)) nil) |
(if (featurep 'lisp-float-type) (/ (float 1) (float 5)) nil) |
308 |
"*If non-nil, time in seconds to delay before overriding prefix key. |
"*If non-nil, time in seconds to delay before overriding prefix key. |
309 |
If there is additional input within this time, the prefix key is |
If there is additional input within this time, the prefix key is |
325 |
(defcustom cua-enable-register-prefix 'not-ctrl-u |
(defcustom cua-enable-register-prefix 'not-ctrl-u |
326 |
"*If non-nil, registers are supported via numeric prefix arg. |
"*If non-nil, registers are supported via numeric prefix arg. |
327 |
If the value is t, any numeric prefix arg in the range 0 to 9 will be |
If the value is t, any numeric prefix arg in the range 0 to 9 will be |
328 |
interpreted as a register number. |
interpreted as a register number. |
329 |
If the value is not-ctrl-u, using C-u to enter a numeric prefix is not |
If the value is not-ctrl-u, using C-u to enter a numeric prefix is not |
330 |
interpreted as a register number. |
interpreted as a register number. |
331 |
If the value is ctrl-u-only, only numeric prefix entered with C-u is |
If the value is ctrl-u-only, only numeric prefix entered with C-u is |
332 |
interpreted as a register number." |
interpreted as a register number." |
333 |
:type '(choice (const :tag "Disabled" nil) |
:type '(choice (const :tag "Disabled" nil) |
334 |
(const :tag "Enabled, but C-u arg is not a register" not-ctrl-u) |
(const :tag "Enabled, but C-u arg is not a register" not-ctrl-u) |
335 |
(const :tag "Enabled, but only for C-u arg" ctrl-u-only) |
(const :tag "Enabled, but only for C-u arg" ctrl-u-only) |
336 |
(other :tag "Enabled" t)) |
(other :tag "Enabled" t)) |
404 |
:type 'boolean |
:type 'boolean |
405 |
:group 'cua) |
:group 'cua) |
406 |
|
|
407 |
(defface cua-global-mark-face '((((class color)) |
(defface cua-global-mark-face '((((class color)) |
408 |
(:foreground "black") |
(:foreground "black") |
409 |
(:background "yellow")) |
(:background "yellow")) |
410 |
(t (:bold t))) |
(t (:bold t))) |
425 |
:type 'boolean |
:type 'boolean |
426 |
:group 'cua) |
:group 'cua) |
427 |
|
|
428 |
(defcustom cua-normal-cursor-color nil |
(defcustom cua-normal-cursor-color (or (and (boundp 'initial-cursor-color) initial-cursor-color) |
429 |
|
(and (boundp 'initial-frame-alist) |
430 |
|
(assoc 'cursor-color initial-frame-alist) |
431 |
|
(cdr (assoc 'cursor-color initial-frame-alist))) |
432 |
|
(and (boundp 'default-frame-alist) |
433 |
|
(assoc 'cursor-color default-frame-alist) |
434 |
|
(cdr (assoc 'cursor-color default-frame-alist))) |
435 |
|
(frame-parameter nil 'cursor-color) |
436 |
|
"red") |
437 |
"Normal (non-overwrite) cursor color. |
"Normal (non-overwrite) cursor color. |
438 |
Also used to indicate that rectangle padding is not in effect. |
Also used to indicate that rectangle padding is not in effect. |
439 |
Automatically loaded from frame parameters, if nil." |
Default is to load cursor color from initial or default frame parameters." |
440 |
:initialize (lambda (symbol value) |
:initialize 'custom-initialize-default |
|
(set symbol (or value |
|
|
(and (boundp 'initial-cursor-color) initial-cursor-color) |
|
|
(and (boundp 'initial-frame-alist) |
|
|
(assoc 'cursor-color initial-frame-alist) |
|
|
(cdr (assoc 'cursor-color initial-frame-alist))) |
|
|
(and (boundp 'default-frame-alist) |
|
|
(assoc 'cursor-color default-frame-alist) |
|
|
(cdr (assoc 'cursor-color default-frame-alist))) |
|
|
(frame-parameter nil 'cursor-color)))) |
|
441 |
:type 'color |
:type 'color |
442 |
:group 'cua) |
:group 'cua) |
443 |
|
|
576 |
(not (numberp cua-prefix-override-inhibit-delay)) |
(not (numberp cua-prefix-override-inhibit-delay)) |
577 |
(<= cua-prefix-override-inhibit-delay 0) |
(<= cua-prefix-override-inhibit-delay 0) |
578 |
;; In state [1], start [T] and change to state [2] |
;; In state [1], start [T] and change to state [2] |
579 |
(run-with-timer cua-prefix-override-inhibit-delay nil |
(run-with-timer cua-prefix-override-inhibit-delay nil |
580 |
'cua--prefix-override-timeout))) |
'cua--prefix-override-timeout))) |
581 |
;; Don't record this command |
;; Don't record this command |
582 |
(setq this-command last-command) |
(setq this-command last-command) |
604 |
(cua-copy-rectangle arg) |
(cua-copy-rectangle arg) |
605 |
(cua-copy-region arg)) |
(cua-copy-region arg)) |
606 |
(let ((keys (this-single-command-keys))) |
(let ((keys (this-single-command-keys))) |
607 |
(setq unread-command-events |
(setq unread-command-events |
608 |
(cons (aref keys (1- (length keys))) unread-command-events)))) |
(cons (aref keys (1- (length keys))) unread-command-events)))) |
609 |
|
|
610 |
(defun cua--prefix-cut-handler (arg) |
(defun cua--prefix-cut-handler (arg) |
614 |
(cua-cut-rectangle arg) |
(cua-cut-rectangle arg) |
615 |
(cua-cut-region arg)) |
(cua-cut-region arg)) |
616 |
(let ((keys (this-single-command-keys))) |
(let ((keys (this-single-command-keys))) |
617 |
(setq unread-command-events |
(setq unread-command-events |
618 |
(cons (aref keys (1- (length keys))) unread-command-events)))) |
(cons (aref keys (1- (length keys))) unread-command-events)))) |
619 |
|
|
620 |
(defun cua--prefix-override-timeout () |
(defun cua--prefix-override-timeout () |
633 |
;; Execute original command |
;; Execute original command |
634 |
(setq this-command this-original-command) |
(setq this-command this-original-command) |
635 |
(call-interactively this-command)) |
(call-interactively this-command)) |
636 |
|
|
637 |
(defun cua--keep-active () |
(defun cua--keep-active () |
638 |
(setq mark-active t |
(setq mark-active t |
639 |
deactivate-mark nil)) |
deactivate-mark nil)) |
650 |
(defvar cua--register nil) |
(defvar cua--register nil) |
651 |
|
|
652 |
(defun cua--prefix-arg (arg) |
(defun cua--prefix-arg (arg) |
653 |
(setq cua--register |
(setq cua--register |
654 |
(and cua-enable-register-prefix |
(and cua-enable-register-prefix |
|
(integerp (this-command-keys)) |
|
|
(cond ((eq cua-enable-register-prefix 'not-ctrl-u) |
|
|
(not (= (aref (this-command-keys) 0) ?\C-u))) |
|
|
((eq cua-enable-register-prefix 'ctrl-u-only) |
|
|
(= (aref (this-command-keys) 0) ?\C-u)) |
|
|
(t t)) |
|
655 |
(integerp arg) (>= arg 0) (< arg 10) |
(integerp arg) (>= arg 0) (< arg 10) |
656 |
|
(let* ((prefix (aref (this-command-keys) 0)) |
657 |
|
(ctrl-u-prefix (and (integerp prefix) |
658 |
|
(= prefix ?\C-u)))) |
659 |
|
(cond |
660 |
|
((eq cua-enable-register-prefix 'not-ctrl-u) |
661 |
|
(not ctrl-u-prefix)) |
662 |
|
((eq cua-enable-register-prefix 'ctrl-u-only) |
663 |
|
ctrl-u-prefix) |
664 |
|
(t t))) |
665 |
(+ arg ?0))) |
(+ arg ?0))) |
666 |
(if cua--register nil arg)) |
(if cua--register nil arg)) |
667 |
|
|
|
|
|
668 |
;;; Enhanced undo - restore rectangle selections |
;;; Enhanced undo - restore rectangle selections |
669 |
|
|
670 |
(defun cua-undo (&optional arg) |
(defun cua-undo (&optional arg) |
691 |
(if cua-delete-copy-to-register-0 |
(if cua-delete-copy-to-register-0 |
692 |
(set-register ?0 cua--last-deleted-region-text)) |
(set-register ?0 cua--last-deleted-region-text)) |
693 |
(delete-region start end) |
(delete-region start end) |
694 |
(setq cua--last-deleted-region-pos |
(setq cua--last-deleted-region-pos |
695 |
(cons (current-buffer) |
(cons (current-buffer) |
696 |
(and (consp buffer-undo-list) |
(and (consp buffer-undo-list) |
697 |
(car buffer-undo-list)))) |
(car buffer-undo-list)))) |
861 |
(defun cua-help-for-region (&optional help) |
(defun cua-help-for-region (&optional help) |
862 |
"Show region specific help in echo area." |
"Show region specific help in echo area." |
863 |
(interactive) |
(interactive) |
864 |
(message |
(message |
865 |
(concat (if help "C-?:help " "") |
(concat (if help "C-?:help " "") |
866 |
"C-z:undo C-x:cut C-c:copy C-v:paste S-ret:rect"))) |
"C-z:undo C-x:cut C-c:copy C-v:paste S-ret:rect"))) |
867 |
|
|
870 |
|
|
871 |
(defun cua-set-mark (&optional arg) |
(defun cua-set-mark (&optional arg) |
872 |
"Set mark at where point is, clear mark, or jump to mark. |
"Set mark at where point is, clear mark, or jump to mark. |
873 |
With no prefix argument, set mark, push old mark position on local mark |
|
874 |
ring, and push mark on global mark ring, or if mark is already set, clear mark. |
With no prefix argument, clear mark if already set. Otherwise, set |
875 |
With argument, jump to mark, and pop a new position for mark off the ring; |
mark, and push old mark position on local mark ring; also push mark on |
876 |
then it jumps to the next mark off the ring if repeated with no argument, or |
global mark ring if last mark was set in another buffer. |
877 |
sets the mark at the new position if repeated with argument." |
|
878 |
|
With argument, jump to mark, and pop a new position for mark off |
879 |
|
the local mark ring \(this does not affect the global mark ring\). |
880 |
|
Use \\[pop-global-mark] to jump to a mark off the global mark ring |
881 |
|
\(see `pop-global-mark'\). |
882 |
|
|
883 |
|
Repeating the command without the prefix jumps to the next position |
884 |
|
off the local \(or global\) mark ring. |
885 |
|
|
886 |
|
With a double \\[universal-argument] prefix argument, unconditionally set mark." |
887 |
(interactive "P") |
(interactive "P") |
888 |
(cond |
(cond |
889 |
|
((and (consp arg) (> (prefix-numeric-value arg) 4)) |
890 |
|
(push-mark-command nil)) |
891 |
((eq last-command 'pop-to-mark-command) |
((eq last-command 'pop-to-mark-command) |
892 |
(if (and (consp arg) (> (prefix-numeric-value arg) 4)) |
(setq this-command 'pop-to-mark-command) |
893 |
(push-mark-command nil) |
(pop-to-mark-command)) |
894 |
(setq this-command 'pop-to-mark-command) |
((and (eq last-command 'pop-global-mark) (not arg)) |
895 |
(pop-to-mark-command))) |
(setq this-command 'pop-global-mark) |
896 |
|
(pop-global-mark)) |
897 |
(arg |
(arg |
898 |
(setq this-command 'pop-to-mark-command) |
(setq this-command 'pop-to-mark-command) |
899 |
(pop-to-mark-command)) |
(pop-to-mark-command)) |
915 |
end-of-buffer beginning-of-buffer |
end-of-buffer beginning-of-buffer |
916 |
scroll-up scroll-down forward-paragraph backward-paragraph) |
scroll-up scroll-down forward-paragraph backward-paragraph) |
917 |
"List of standard movement commands. |
"List of standard movement commands. |
918 |
Extra commands should be added to `cua-user-movement-commands'") |
Extra commands should be added to `cua-movement-commands'") |
919 |
|
|
920 |
(defvar cua-movement-commands nil |
(defvar cua-movement-commands nil |
921 |
"User may add additional movement commands to this list.") |
"User may add additional movement commands to this list.") |
971 |
(unless mark-active |
(unless mark-active |
972 |
(push-mark-command nil nil))) |
(push-mark-command nil nil))) |
973 |
(t |
(t |
974 |
;; If we set mark-active to nil here, the region highlight will not be |
;; If we set mark-active to nil here, the region highlight will not be |
975 |
;; removed by the direct_output_ commands. |
;; removed by the direct_output_ commands. |
976 |
(setq deactivate-mark t))) |
(setq deactivate-mark t))) |
977 |
|
|
981 |
(get this-command 'pending-delete))) |
(get this-command 'pending-delete))) |
982 |
(nc (cond |
(nc (cond |
983 |
((not ds) nil) |
((not ds) nil) |
984 |
((eq ds 'yank) |
((eq ds 'yank) |
985 |
'cua-paste) |
'cua-paste) |
986 |
((eq ds 'kill) |
((eq ds 'kill) |
987 |
(if cua--rectangle |
(if cua--rectangle |
989 |
'cua-copy-region)) |
'cua-copy-region)) |
990 |
((eq ds 'supersede) |
((eq ds 'supersede) |
991 |
(if cua--rectangle |
(if cua--rectangle |
992 |
'cua-delete-rectangle ;; replace? |
'cua-delete-rectangle |
993 |
'cua-replace-region)) |
'cua-delete-region)) |
994 |
(t |
(t |
995 |
(if cua--rectangle |
(if cua--rectangle |
996 |
'cua-delete-rectangle |
'cua-delete-rectangle ;; replace? |
997 |
'cua-delete-region))))) |
'cua-replace-region))))) |
998 |
(if nc |
(if nc |
999 |
(setq this-original-command this-command |
(setq this-original-command this-command |
1000 |
this-command nc))))) |
this-command nc))))) |
1001 |
|
|
1002 |
;; Detect extension of rectangles by mouse or other movement |
;; Detect extension of rectangles by mouse or other movement |
1003 |
(setq cua--buffer-and-point-before-command |
(setq cua--buffer-and-point-before-command |
1004 |
(if cua--rectangle (cons (current-buffer) (point)))) |
(if cua--rectangle (cons (current-buffer) (point)))) |
1005 |
) |
) |
1006 |
(error nil))) |
(error nil))) |
1020 |
|
|
1021 |
;; Debugging |
;; Debugging |
1022 |
(if cua--debug |
(if cua--debug |
1023 |
(cond |
(cond |
1024 |
(cua--rectangle (cua--rectangle-assert)) |
(cua--rectangle (cua--rectangle-assert)) |
1025 |
(mark-active (message "Mark=%d Point=%d Expl=%s" |
(mark-active (message "Mark=%d Point=%d Expl=%s" |
1026 |
(mark t) (point) cua--explicit-region-start)))) |
(mark t) (point) cua--explicit-region-start)))) |
1127 |
(define-key cua-global-keymap [remap advertised-undo] 'cua-undo) |
(define-key cua-global-keymap [remap advertised-undo] 'cua-undo) |
1128 |
|
|
1129 |
(define-key cua--cua-keys-keymap [(control x) timeout] 'kill-region) |
(define-key cua--cua-keys-keymap [(control x) timeout] 'kill-region) |
|
(define-key cua--cua-keys-keymap [(shift control x)] 'Control-X-prefix) |
|
1130 |
(define-key cua--cua-keys-keymap [(control c) timeout] 'copy-region-as-kill) |
(define-key cua--cua-keys-keymap [(control c) timeout] 'copy-region-as-kill) |
|
(define-key cua--cua-keys-keymap [(shift control c)] 'mode-specific-command-prefix) |
|
1131 |
(define-key cua--cua-keys-keymap [(control z)] 'undo) |
(define-key cua--cua-keys-keymap [(control z)] 'undo) |
1132 |
(define-key cua--cua-keys-keymap [(control v)] 'yank) |
(define-key cua--cua-keys-keymap [(control v)] 'yank) |
1133 |
(define-key cua--cua-keys-keymap [(meta v)] 'cua-repeat-replace-region) |
(define-key cua--cua-keys-keymap [(meta v)] 'cua-repeat-replace-region) |
1135 |
|
|
1136 |
(define-key cua--prefix-override-keymap [(control x)] 'cua--prefix-override-handler) |
(define-key cua--prefix-override-keymap [(control x)] 'cua--prefix-override-handler) |
1137 |
(define-key cua--prefix-override-keymap [(control c)] 'cua--prefix-override-handler) |
(define-key cua--prefix-override-keymap [(control c)] 'cua--prefix-override-handler) |
1138 |
|
|
1139 |
(define-key cua--prefix-repeat-keymap [(control x) (control x)] 'cua--prefix-repeat-handler) |
(define-key cua--prefix-repeat-keymap [(control x) (control x)] 'cua--prefix-repeat-handler) |
1140 |
(define-key cua--prefix-repeat-keymap [(control x) up] 'cua--prefix-cut-handler) |
(define-key cua--prefix-repeat-keymap [(control x) up] 'cua--prefix-cut-handler) |
1141 |
(define-key cua--prefix-repeat-keymap [(control x) down] 'cua--prefix-cut-handler) |
(define-key cua--prefix-repeat-keymap [(control x) down] 'cua--prefix-cut-handler) |
1147 |
(define-key cua--prefix-repeat-keymap [(control c) left] 'cua--prefix-copy-handler) |
(define-key cua--prefix-repeat-keymap [(control c) left] 'cua--prefix-copy-handler) |
1148 |
(define-key cua--prefix-repeat-keymap [(control c) right] 'cua--prefix-copy-handler) |
(define-key cua--prefix-repeat-keymap [(control c) right] 'cua--prefix-copy-handler) |
1149 |
|
|
1150 |
|
;; Enable shifted fallbacks for C-x and C-c when region is active |
1151 |
|
(define-key cua--region-keymap [(shift control x)] 'Control-X-prefix) |
1152 |
|
(define-key cua--region-keymap [(shift control c)] 'mode-specific-command-prefix) |
1153 |
;; replace current region |
;; replace current region |
1154 |
(define-key cua--region-keymap [remap self-insert-command] 'cua-replace-region) |
(define-key cua--region-keymap [remap self-insert-command] 'cua-replace-region) |
1155 |
(define-key cua--region-keymap [remap self-insert-iso] 'cua-replace-region) |
(define-key cua--region-keymap [remap self-insert-iso] 'cua-replace-region) |
1261 |
(interactive) |
(interactive) |
1262 |
(setq cua--debug (not cua--debug))) |
(setq cua--debug (not cua--debug))) |
1263 |
|
|
1264 |
|
;; Install run-time check for older versions of CUA-mode which does not |
1265 |
|
;; work with GNU Emacs version 21.4 and newer. |
1266 |
|
;; |
1267 |
|
;; Except for version 1.2, all of the 1.x and 2.x version of cua-mode |
1268 |
|
;; provided the `CUA-mode' feature. Since this is no longer true, |
1269 |
|
;; we can warn the user if the `CUA-mode' feature is ever provided. |
1270 |
|
|
1271 |
|
;;;###autoload (eval-after-load 'CUA-mode |
1272 |
|
;;;###autoload '(error (concat "\n\n" |
1273 |
|
;;;###autoload "CUA-mode is now part of the standard GNU Emacs distribution,\n" |
1274 |
|
;;;###autoload "so you may now enable and customize CUA via the Options menu.\n\n" |
1275 |
|
;;;###autoload "Your " (file-name-nondirectory user-init-file) " loads an older version of CUA-mode which does\n" |
1276 |
|
;;;###autoload "not work correctly with this version of GNU Emacs.\n" |
1277 |
|
;;;###autoload "To correct this, remove the loading and customization of the\n" |
1278 |
|
;;;###autoload "old version from the " user-init-file " file.\n\n"))) |
1279 |
|
|
1280 |
|
(provide 'cua) |
1281 |
|
|
1282 |
;;; cua-base.el ends here |
;;; cua-base.el ends here |