Mercurial > emacs
annotate lisp/emulation/cua-base.el @ 112408:04c350138c72
* man.el (Man-highlight-references0): Use make-button (Bug#7881).
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Fri, 21 Jan 2011 22:53:06 -0500 |
parents | 61f7601898b1 |
children |
rev | line source |
---|---|
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1 ;;; cua-base.el --- emulate CUA key bindings |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
2 |
112284
61f7601898b1
Refill some copyright headers.
Glenn Morris <rgm@gnu.org>
parents:
112228
diff
changeset
|
3 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, |
61f7601898b1
Refill some copyright headers.
Glenn Morris <rgm@gnu.org>
parents:
112228
diff
changeset
|
4 ;; 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
5 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
6 ;; Author: Kim F. Storm <storm@cua.dk> |
109280
cc75fd2ab734
Fix typos in some Keywords comments.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
7 ;; Keywords: keyboard emulations convenience cua |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
8 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
10 |
94658
eb7b2376cae5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
94658
eb7b2376cae5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
eb7b2376cae5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
14 ;; (at your option) any later version. |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
15 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
20 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
94658
eb7b2376cae5
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
23 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
24 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
25 ;;; Commentary: |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
26 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
27 ;; This is the CUA package which provides a complete emulation of the |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
28 ;; standard CUA key bindings (Motif/Windows/Mac GUI) for selecting and |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
29 ;; manipulating the region where S-<movement> is used to highlight & |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
30 ;; extend the region. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
31 |
45520
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
32 ;; CUA style key bindings for cut and paste |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
33 ;; ---------------------------------------- |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
34 |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
35 ;; This package allows the C-z, C-x, C-c, and C-v keys to be |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
36 ;; bound appropriately according to the Motif/Windows GUI, i.e. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
37 ;; C-z -> undo |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
38 ;; C-x -> cut |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
39 ;; C-c -> copy |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
40 ;; C-v -> paste |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
41 ;; |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
42 ;; The tricky part is the handling of the C-x and C-c keys which |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
43 ;; are normally used as prefix keys for most of emacs' built-in |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
44 ;; commands. With CUA they still do!!! |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
45 ;; |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
46 ;; Only when the region is currently active (and highlighted since |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
47 ;; transient-mark-mode is used), the C-x and C-c keys will work as CUA |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
48 ;; keys |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
49 ;; C-x -> cut |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
50 ;; C-c -> copy |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
51 ;; When the region is not active, C-x and C-c works as prefix keys! |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
52 ;; |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
53 ;; This probably sounds strange and difficult to get used to - but |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
54 ;; based on my own experience and the feedback from many users of |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
55 ;; this package, it actually works very well and users adapt to it |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
56 ;; instantly - or at least very quickly. So give it a try! |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
57 ;; ... and in the few cases where you make a mistake and accidentally |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
58 ;; delete the region - you just undo the mistake (with C-z). |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
59 ;; |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
60 ;; If you really need to perform a command which starts with one of |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
61 ;; the prefix keys even when the region is active, you have three options: |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
62 ;; - press the prefix key twice very quickly (within 0.2 seconds), |
64558
19736ad15819
(cua-mode, cua-enable-register-prefix, cua-enable-cua-keys, cua-use-hyper-key,
Juanma Barranquero <lekktu@gmail.com>
parents:
64527
diff
changeset
|
63 ;; - press the prefix key and the following key within 0.2 seconds, or |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
64 ;; - use the SHIFT key with the prefix key, i.e. C-X or C-C |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
65 ;; |
96376
c3309dba6542
American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents:
94869
diff
changeset
|
66 ;; This behavior can be customized via the |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
67 ;; cua-prefix-override-inhibit-delay variable. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
68 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
69 ;; In addition to using the shifted movement keys, you can also use |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
70 ;; [C-space] to start the region and use unshifted movement keys to extend |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
71 ;; it. To cancel the region, use [C-space] or [C-g]. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
72 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
73 ;; If you prefer to use the standard emacs cut, copy, paste, and undo |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
74 ;; bindings, customize cua-enable-cua-keys to nil. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
75 |
45520
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
76 |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
77 ;; Typing text replaces the region |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
78 ;; ------------------------------- |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
79 |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
80 ;; When the region is active, i.e. highlighted, the text in region is |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
81 ;; replaced by the text you type. |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
82 |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
83 ;; The replaced text is saved in register 0 which can be inserted using |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
84 ;; the key sequence M-0 C-v (see the section on register support below). |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
85 |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
86 ;; If you have just replaced a highlighted region with typed text, |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
87 ;; you can repeat the replace with M-v. This will search forward |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
88 ;; for a streach of text identical to the previous contents of the |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
89 ;; region (i.e. the contents of register 0) and replace it with the |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
90 ;; text you typed to replace the original region. Repeating M-v will |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
91 ;; replace the next matching region and so on. |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
92 ;; |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
93 ;; Example: Suppose you have a line like this |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
94 ;; The redo operation will redo the last redoable command |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
95 ;; which you want to change into |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
96 ;; The repeat operation will repeat the last repeatable command |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
97 ;; This is done by highlighting the first occurrence of "redo" |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
98 ;; and type "repeat" M-v M-v. |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
99 |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
100 ;; Note: Since CUA-mode duplicates the functionality of the |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
101 ;; delete-selection-mode, that mode is automatically disabled when |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
102 ;; CUA-mode is enabled. |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
103 |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
104 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
105 ;; CUA mode indications |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
106 ;; -------------------- |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
107 ;; You can choose to let CUA use different cursor colors to indicate |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
108 ;; overwrite mode and read-only buffers. For example, the following |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
109 ;; setting will use a RED cursor in normal (insertion) mode in |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
110 ;; read-write buffers, a YELLOW cursor in overwrite mode in read-write |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
111 ;; buffers, and a GREEN cursor read-only buffers: |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
112 ;; |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
113 ;; (setq cua-normal-cursor-color "red") |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
114 ;; (setq cua-overwrite-cursor-color "yellow") |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
115 ;; (setq cua-read-only-cursor-color "green") |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
116 ;; |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
117 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
118 ;; CUA register support |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
119 ;; -------------------- |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
120 ;; Emacs' standard register support is also based on a separate set of |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
121 ;; "register commands". |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
122 ;; |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
123 ;; CUA's register support is activated by providing a numeric |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
124 ;; prefix argument to the C-x, C-c, and C-v commands. For example, |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
125 ;; to copy the selected region to register 2, enter [M-2 C-c]. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
126 ;; Or if you have activated the keypad prefix mode, enter [kp-2 C-c]. |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
127 ;; |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
128 ;; And CUA will copy and paste normal region as well as rectangles |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
129 ;; into the registers, i.e. you use exactly the same command for both. |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
130 ;; |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
131 ;; In addition, the last highlighted text that is deleted (not |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
132 ;; copied), e.g. by [delete] or by typing text over a highlighted |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
133 ;; region, is automatically saved in register 0, so you can insert it |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
134 ;; using [M-0 C-v]. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
135 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
136 ;; CUA rectangle support |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
137 ;; --------------------- |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
138 ;; Emacs' normal rectangle support is based on interpreting the region |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
139 ;; between the mark and point as a "virtual rectangle", and using a |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
140 ;; completely separate set of "rectangle commands" [C-x r ...] on the |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
141 ;; region to copy, kill, fill a.s.o. the virtual rectangle. |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
142 ;; |
56839
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
143 ;; cua-mode's superior rectangle support uses a true visual |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
144 ;; representation of the selected rectangle, i.e. it highlights the |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
145 ;; actual part of the buffer that is currently selected as part of the |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
146 ;; rectangle. Unlike emacs' traditional rectangle commands, the |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
147 ;; selected rectangle always as straight left and right edges, even |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
148 ;; when those are in the middle of a TAB character or beyond the end |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
149 ;; of the current line. And it does this without actually modifying |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
150 ;; the buffer contents (it uses display overlays to visualize the |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
151 ;; virtual dimensions of the rectangle). |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
152 ;; |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
153 ;; This means that cua-mode's rectangles are not limited to the actual |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
154 ;; contents of the buffer, so if the cursor is currently at the end of a |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
155 ;; short line, you can still extend the rectangle to include more columns |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
156 ;; of longer lines in the same rectangle. And you can also have the |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
157 ;; left edge of a rectangle start in the middle of a TAB character. |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
158 ;; Sounds strange? Try it! |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
159 ;; |
62449
be9a675832ec
(cua-use-hyper-key): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
62440
diff
changeset
|
160 ;; To start a rectangle, use [C-return] and extend it using the normal |
56839
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
161 ;; movement keys (up, down, left, right, home, end, C-home, |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
162 ;; C-end). Once the rectangle has the desired size, you can cut or |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
163 ;; copy it using C-x and C-c (or C-w and M-w), and you can |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
164 ;; subsequently insert it - as a rectangle - using C-v (or C-y). So |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
165 ;; the only new command you need to know to work with cua-mode |
62449
be9a675832ec
(cua-use-hyper-key): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
62440
diff
changeset
|
166 ;; rectangles is C-return! |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
167 ;; |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
168 ;; Normally, when you paste a rectangle using C-v (C-y), each line of |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
169 ;; the rectangle is inserted into the existing lines in the buffer. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
170 ;; If overwrite-mode is active when you paste a rectangle, it is |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
171 ;; inserted as normal (multi-line) text. |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
172 ;; |
56839
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
173 ;; If you prefer the traditional rectangle marking (i.e. don't want |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
174 ;; straight edges), [M-p] toggles this for the current rectangle, |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
175 ;; or you can customize cua-virtual-rectangle-edges. |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
176 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
177 ;; And there's more: If you want to extend or reduce the size of the |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
178 ;; rectangle in one of the other corners of the rectangle, just use |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
179 ;; [return] to move the cursor to the "next" corner. Or you can use |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
180 ;; the [M-up], [M-down], [M-left], and [M-right] keys to move the |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
181 ;; entire rectangle overlay (but not the contents) in the given |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
182 ;; direction. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
183 ;; |
62449
be9a675832ec
(cua-use-hyper-key): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
62440
diff
changeset
|
184 ;; [C-return] cancels the rectangle |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
185 ;; [C-space] activates the region bounded by the rectangle |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
186 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
187 ;; If you type a normal (self-inserting) character when the rectangle is |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
188 ;; active, the character is inserted on the "current side" of every line |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
189 ;; of the rectangle. The "current side" is the side on which the cursor |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
190 ;; is currently located. If the rectangle is only 1 column wide, |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
191 ;; insertion will be performed to the left when the cursor is at the |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
192 ;; bottom of the rectangle. So, for example, to comment out an entire |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
193 ;; paragraph like this one, just place the cursor on the first character |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
194 ;; of the first line, and enter the following: |
62449
be9a675832ec
(cua-use-hyper-key): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
62440
diff
changeset
|
195 ;; C-return M-} ; ; <space> C-return |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
196 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
197 ;; cua-mode's rectangle support also includes all the normal rectangle |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
198 ;; functions with easy access: |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
199 ;; |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
200 ;; [M-a] aligns all words at the left edge of the rectangle |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
201 ;; [M-b] fills the rectangle with blanks (tabs and spaces) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
202 ;; [M-c] closes the rectangle by removing all blanks at the left edge |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
203 ;; of the rectangle |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
204 ;; [M-f] fills the rectangle with a single character (prompt) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
205 ;; [M-i] increases the first number found on each line of the rectangle |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
206 ;; by the amount given by the numeric prefix argument (default 1) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
207 ;; It recognizes 0x... as hexadecimal numbers |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
208 ;; [M-k] kills the rectangle as normal multi-line text (for paste) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
209 ;; [M-l] downcases the rectangle |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
210 ;; [M-m] copies the rectangle as normal multi-line text (for paste) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
211 ;; [M-n] fills each line of the rectangle with increasing numbers using |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
212 ;; a supplied format string (prompt) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
213 ;; [M-o] opens the rectangle by moving the highlighted text to the |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
214 ;; right of the rectangle and filling the rectangle with blanks. |
56839
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
215 ;; [M-p] toggles virtual straight rectangle edges |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
216 ;; [M-P] inserts tabs and spaces (padding) to make real straight edges |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
217 ;; [M-q] performs text filling on the rectangle |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
218 ;; [M-r] replaces REGEXP (prompt) by STRING (prompt) in rectangle |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
219 ;; [M-R] reverse the lines in the rectangle |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
220 ;; [M-s] fills each line of the rectangle with the same STRING (prompt) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
221 ;; [M-t] performs text fill of the rectangle with TEXT (prompt) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
222 ;; [M-u] upcases the rectangle |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
223 ;; [M-|] runs shell command on rectangle |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
224 ;; [M-'] restricts rectangle to lines with CHAR (prompt) at left column |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
225 ;; [M-/] restricts rectangle to lines matching REGEXP (prompt) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
226 ;; [C-?] Shows a brief list of the above commands. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
227 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
228 ;; [M-C-up] and [M-C-down] scrolls the lines INSIDE the rectangle up |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
229 ;; and down; lines scrolled outside the top or bottom of the rectangle |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
230 ;; are lost, but can be recovered using [C-z]. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
231 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
232 ;; CUA Global Mark |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
233 ;; --------------- |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
234 ;; The final feature provided by CUA is the "global mark", which |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
235 ;; makes it very easy to copy bits and pieces from the same and other |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
236 ;; files into the current text. To enable and cancel the global mark, |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
237 ;; use [S-C-space]. The cursor will blink when the global mark |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
238 ;; is active. The following commands behave differently when the global |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
239 ;; mark is set: |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
240 ;; <ch> All characters (including newlines) you type are inserted |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
241 ;; at the global mark! |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
242 ;; [C-x] If you cut a region or rectangle, it is automatically inserted |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
243 ;; at the global mark, and the global mark is advanced. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
244 ;; [C-c] If you copy a region or rectangle, it is immediately inserted |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
245 ;; at the global mark, and the global mark is advanced. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
246 ;; [C-v] Copies a single character to the global mark. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
247 ;; [C-d] Moves (i.e. deletes and inserts) a single character to the |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
248 ;; global mark. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
249 ;; [backspace] deletes the character before the global mark, while |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
250 ;; [delete] deltes the character after the global mark. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
251 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
252 ;; [S-C-space] Jumps to and cancels the global mark. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
253 ;; [C-u S-C-space] Cancels the global mark (stays in current buffer). |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
254 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
255 ;; [TAB] Indents the current line or rectangle to the column of the |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
256 ;; global mark. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
257 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
258 ;;; Code: |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
259 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
260 ;;; Customization |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
261 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
262 (defgroup cua nil |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
263 "Emulate CUA key bindings including C-x and C-c." |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
264 :prefix "cua" |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
265 :group 'editing-basics |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
266 :group 'convenience |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
267 :group 'emulations |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59972
diff
changeset
|
268 :version "22.1" |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
269 :link '(emacs-commentary-link :tag "Commentary" "cua-base.el") |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
270 :link '(emacs-library-link :tag "Lisp File" "cua-base.el")) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
271 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
272 (defcustom cua-enable-cua-keys t |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
273 "Enable using C-z, C-x, C-c, and C-v for undo, cut, copy, and paste. |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
274 If the value is t, these mappings are always enabled. If the value is |
64558
19736ad15819
(cua-mode, cua-enable-register-prefix, cua-enable-cua-keys, cua-use-hyper-key,
Juanma Barranquero <lekktu@gmail.com>
parents:
64527
diff
changeset
|
275 `shift', these keys are only enabled if the last region was marked with |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
276 a shifted movement key. If the value is nil, these keys are never |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
277 enabled." |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
278 :type '(choice (const :tag "Disabled" nil) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
279 (const :tag "Shift region only" shift) |
45231 | 280 (other :tag "Enabled" t)) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
281 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
282 |
92353 | 283 (defcustom cua-remap-control-v t |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
284 "If non-nil, C-v binding is used for paste (yank). |
92353 | 285 Also, M-v is mapped to `cua-repeat-replace-region'." |
286 :type 'boolean | |
287 :group 'cua) | |
288 | |
289 (defcustom cua-remap-control-z t | |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
290 "If non-nil, C-z binding is used for undo." |
92353 | 291 :type 'boolean |
292 :group 'cua) | |
293 | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
294 (defcustom cua-highlight-region-shift-only nil |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
295 "If non-nil, only highlight region if marked with S-<move>. |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
296 When this is non-nil, CUA toggles `transient-mark-mode' on when the region |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
297 is marked using shifted movement keys, and off when the mark is cleared. |
79409
5228ca1272a5
(cua-highlight-region-shift-only, cua-paste-pop): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
78551
diff
changeset
|
298 But when the mark was set using \\[cua-set-mark], Transient Mark mode |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
299 is not turned on." |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
300 :type 'boolean |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
301 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
302 |
111091
a5d92e87313c
Support for systems without floats was removed a decade ago.
Glenn Morris <rgm@gnu.org>
parents:
110494
diff
changeset
|
303 (defcustom cua-prefix-override-inhibit-delay 0.2 |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
304 "If non-nil, time in seconds to delay before overriding prefix key. |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
305 If there is additional input within this time, the prefix key is |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
306 used as a normal prefix key. So typing a key sequence quickly will |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
307 inhibit overriding the prefix key. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
308 As a special case, if the prefix keys repeated within this time, the |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
309 first prefix key is discarded, so typing a prefix key twice in quick |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
310 succession will also inhibit overriding the prefix key. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
311 If the value is nil, use a shifted prefix key to inhibit the override." |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
312 :type '(choice (number :tag "Inhibit delay") |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
313 (const :tag "No delay" nil)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
314 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
315 |
71905
8e9a2b05bd3d
(cua-delete-selection, cua-toggle-set-mark): New defcustoms.
Kim F. Storm <storm@cua.dk>
parents:
70799
diff
changeset
|
316 (defcustom cua-delete-selection t |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
317 "If non-nil, typed text replaces text in the active selection." |
71905
8e9a2b05bd3d
(cua-delete-selection, cua-toggle-set-mark): New defcustoms.
Kim F. Storm <storm@cua.dk>
parents:
70799
diff
changeset
|
318 :type '(choice (const :tag "Disabled" nil) |
8e9a2b05bd3d
(cua-delete-selection, cua-toggle-set-mark): New defcustoms.
Kim F. Storm <storm@cua.dk>
parents:
70799
diff
changeset
|
319 (other :tag "Enabled" t)) |
8e9a2b05bd3d
(cua-delete-selection, cua-toggle-set-mark): New defcustoms.
Kim F. Storm <storm@cua.dk>
parents:
70799
diff
changeset
|
320 :group 'cua) |
8e9a2b05bd3d
(cua-delete-selection, cua-toggle-set-mark): New defcustoms.
Kim F. Storm <storm@cua.dk>
parents:
70799
diff
changeset
|
321 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
322 (defcustom cua-keep-region-after-copy nil |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
323 "If non-nil, don't deselect the region after copying." |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
324 :type 'boolean |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
325 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
326 |
71905
8e9a2b05bd3d
(cua-delete-selection, cua-toggle-set-mark): New defcustoms.
Kim F. Storm <storm@cua.dk>
parents:
70799
diff
changeset
|
327 (defcustom cua-toggle-set-mark t |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
328 "If non-nil, the `cua-set-mark' command toggles the mark." |
71905
8e9a2b05bd3d
(cua-delete-selection, cua-toggle-set-mark): New defcustoms.
Kim F. Storm <storm@cua.dk>
parents:
70799
diff
changeset
|
329 :type '(choice (const :tag "Disabled" nil) |
8e9a2b05bd3d
(cua-delete-selection, cua-toggle-set-mark): New defcustoms.
Kim F. Storm <storm@cua.dk>
parents:
70799
diff
changeset
|
330 (other :tag "Enabled" t)) |
8e9a2b05bd3d
(cua-delete-selection, cua-toggle-set-mark): New defcustoms.
Kim F. Storm <storm@cua.dk>
parents:
70799
diff
changeset
|
331 :group 'cua) |
8e9a2b05bd3d
(cua-delete-selection, cua-toggle-set-mark): New defcustoms.
Kim F. Storm <storm@cua.dk>
parents:
70799
diff
changeset
|
332 |
74365
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
333 (defcustom cua-auto-mark-last-change nil |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
334 "If non-nil, set implicit mark at position of last buffer change. |
74365
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
335 This means that \\[universal-argument] \\[cua-set-mark] will jump to the position |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
336 of the last buffer change before jumping to the explicit marks on the mark ring. |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
337 See `cua-set-mark' for details." |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
338 :type 'boolean |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
339 :group 'cua) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
340 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
341 (defcustom cua-enable-register-prefix 'not-ctrl-u |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
342 "If non-nil, registers are supported via numeric prefix arg. |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
343 If the value is t, any numeric prefix arg in the range 0 to 9 will be |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
344 interpreted as a register number. |
64558
19736ad15819
(cua-mode, cua-enable-register-prefix, cua-enable-cua-keys, cua-use-hyper-key,
Juanma Barranquero <lekktu@gmail.com>
parents:
64527
diff
changeset
|
345 If the value is `not-ctrl-u', using C-u to enter a numeric prefix is not |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
346 interpreted as a register number. |
64558
19736ad15819
(cua-mode, cua-enable-register-prefix, cua-enable-cua-keys, cua-use-hyper-key,
Juanma Barranquero <lekktu@gmail.com>
parents:
64527
diff
changeset
|
347 If the value is `ctrl-u-only', only numeric prefix entered with C-u is |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
348 interpreted as a register number." |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
349 :type '(choice (const :tag "Disabled" nil) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
350 (const :tag "Enabled, but C-u arg is not a register" not-ctrl-u) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
351 (const :tag "Enabled, but only for C-u arg" ctrl-u-only) |
45231 | 352 (other :tag "Enabled" t)) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
353 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
354 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
355 (defcustom cua-delete-copy-to-register-0 t |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
356 "If non-nil, save last deleted region or rectangle to register 0." |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
357 :type 'boolean |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
358 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
359 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
360 (defcustom cua-enable-region-auto-help nil |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
361 "If non-nil, automatically show help for active region." |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
362 :type 'boolean |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
363 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
364 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
365 (defcustom cua-enable-modeline-indications nil |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
366 "If non-nil, use minor-mode hook to show status in mode line." |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
367 :type 'boolean |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
368 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
369 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
370 (defcustom cua-check-pending-input t |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
371 "If non-nil, don't override prefix key if input pending. |
63869
e7c533a3b1b9
(cua-check-pending-input, cua-repeat-replace-region, cua-mode, cua-debug,
Juanma Barranquero <lekktu@gmail.com>
parents:
63388
diff
changeset
|
372 It is rumoured that `input-pending-p' is unreliable under some window |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
373 managers, so try setting this to nil, if prefix override doesn't work." |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
374 :type 'boolean |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
375 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
376 |
74365
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
377 (defcustom cua-paste-pop-rotate-temporarily nil |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
378 "If non-nil, \\[cua-paste-pop] only rotates the kill-ring temporarily. |
74454
7d244d3c8089
(cua-paste-pop-rotate-temporarily): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
74365
diff
changeset
|
379 This means that both \\[yank] and the first \\[yank-pop] in a sequence always insert |
7d244d3c8089
(cua-paste-pop-rotate-temporarily): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
74365
diff
changeset
|
380 the most recently killed text. Each immediately following \\[cua-paste-pop] replaces |
7d244d3c8089
(cua-paste-pop-rotate-temporarily): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
74365
diff
changeset
|
381 the previous text with the next older element on the `kill-ring'. |
7d244d3c8089
(cua-paste-pop-rotate-temporarily): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
74365
diff
changeset
|
382 With prefix arg, \\[universal-argument] \\[yank-pop] inserts the same text as the most |
7d244d3c8089
(cua-paste-pop-rotate-temporarily): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
74365
diff
changeset
|
383 recent \\[yank-pop] (or \\[yank]) command." |
74365
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
384 :type 'boolean |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
385 :group 'cua) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
386 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
387 ;;; Rectangle Customization |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
388 |
56839
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
389 (defcustom cua-virtual-rectangle-edges t |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
390 "If non-nil, rectangles have virtual straight edges. |
56839
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
391 Note that although rectangles are always DISPLAYED with straight edges, the |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
392 buffer is NOT modified, until you execute a command that actually modifies it. |
64558
19736ad15819
(cua-mode, cua-enable-register-prefix, cua-enable-cua-keys, cua-use-hyper-key,
Juanma Barranquero <lekktu@gmail.com>
parents:
64527
diff
changeset
|
393 M-p toggles this feature when a rectangle is active." |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
394 :type 'boolean |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
395 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
396 |
56839
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
397 (defcustom cua-auto-tabify-rectangles 1000 |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
398 "If non-nil, automatically tabify after rectangle commands. |
56839
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
399 This basically means that `tabify' is applied to all lines that |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
400 are modified by inserting or deleting a rectangle. If value is |
63869
e7c533a3b1b9
(cua-check-pending-input, cua-repeat-replace-region, cua-mode, cua-debug,
Juanma Barranquero <lekktu@gmail.com>
parents:
63388
diff
changeset
|
401 an integer, CUA will look for existing tabs in a region around |
56839
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
402 the rectangle, and only do the conversion if any tabs are already |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
403 present. The number specifies then number of characters before |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
404 and after the region marked by the rectangle to search." |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
405 :type '(choice (number :tag "Auto detect (limit)") |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
406 (const :tag "Disabled" nil) |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
407 (other :tag "Enabled" t)) |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
408 :group 'cua) |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
409 |
75488
cfbd9931b493
(cua-global-keymap, cua--region-keymap):
Kim F. Storm <storm@cua.dk>
parents:
75346
diff
changeset
|
410 (defvar cua-global-keymap) ; forward |
cfbd9931b493
(cua-global-keymap, cua--region-keymap):
Kim F. Storm <storm@cua.dk>
parents:
75346
diff
changeset
|
411 (defvar cua--region-keymap) ; forward |
cfbd9931b493
(cua-global-keymap, cua--region-keymap):
Kim F. Storm <storm@cua.dk>
parents:
75346
diff
changeset
|
412 |
69668
16f8a4a89f79
(cua-rectangle-mark-key): New defcustom.
Kim F. Storm <storm@cua.dk>
parents:
68648
diff
changeset
|
413 (defcustom cua-rectangle-mark-key [(control return)] |
16f8a4a89f79
(cua-rectangle-mark-key): New defcustom.
Kim F. Storm <storm@cua.dk>
parents:
68648
diff
changeset
|
414 "Global key used to toggle the cua rectangle mark." |
16f8a4a89f79
(cua-rectangle-mark-key): New defcustom.
Kim F. Storm <storm@cua.dk>
parents:
68648
diff
changeset
|
415 :set #'(lambda (symbol value) |
16f8a4a89f79
(cua-rectangle-mark-key): New defcustom.
Kim F. Storm <storm@cua.dk>
parents:
68648
diff
changeset
|
416 (set symbol value) |
86102
79412c640bdf
(cua--keymaps-initialized): Rename from `cua--keymaps-initalized'.
Juanma Barranquero <lekktu@gmail.com>
parents:
86101
diff
changeset
|
417 (when (and (boundp 'cua--keymaps-initialized) |
79412c640bdf
(cua--keymaps-initialized): Rename from `cua--keymaps-initalized'.
Juanma Barranquero <lekktu@gmail.com>
parents:
86101
diff
changeset
|
418 cua--keymaps-initialized) |
69668
16f8a4a89f79
(cua-rectangle-mark-key): New defcustom.
Kim F. Storm <storm@cua.dk>
parents:
68648
diff
changeset
|
419 (define-key cua-global-keymap value |
16f8a4a89f79
(cua-rectangle-mark-key): New defcustom.
Kim F. Storm <storm@cua.dk>
parents:
68648
diff
changeset
|
420 'cua-set-rectangle-mark) |
16f8a4a89f79
(cua-rectangle-mark-key): New defcustom.
Kim F. Storm <storm@cua.dk>
parents:
68648
diff
changeset
|
421 (when (boundp 'cua--rectangle-keymap) |
16f8a4a89f79
(cua-rectangle-mark-key): New defcustom.
Kim F. Storm <storm@cua.dk>
parents:
68648
diff
changeset
|
422 (define-key cua--rectangle-keymap value |
16f8a4a89f79
(cua-rectangle-mark-key): New defcustom.
Kim F. Storm <storm@cua.dk>
parents:
68648
diff
changeset
|
423 'cua-clear-rectangle-mark) |
16f8a4a89f79
(cua-rectangle-mark-key): New defcustom.
Kim F. Storm <storm@cua.dk>
parents:
68648
diff
changeset
|
424 (define-key cua--region-keymap value |
16f8a4a89f79
(cua-rectangle-mark-key): New defcustom.
Kim F. Storm <storm@cua.dk>
parents:
68648
diff
changeset
|
425 'cua-toggle-rectangle-mark)))) |
16f8a4a89f79
(cua-rectangle-mark-key): New defcustom.
Kim F. Storm <storm@cua.dk>
parents:
68648
diff
changeset
|
426 :type 'key-sequence |
16f8a4a89f79
(cua-rectangle-mark-key): New defcustom.
Kim F. Storm <storm@cua.dk>
parents:
68648
diff
changeset
|
427 :group 'cua) |
16f8a4a89f79
(cua-rectangle-mark-key): New defcustom.
Kim F. Storm <storm@cua.dk>
parents:
68648
diff
changeset
|
428 |
67405
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
429 (defcustom cua-rectangle-modifier-key 'meta |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
430 "Modifier key used for rectangle commands bindings. |
67405
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
431 On non-window systems, always use the meta modifier. |
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
432 Must be set prior to enabling CUA." |
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
433 :type '(choice (const :tag "Meta key" meta) |
71905
8e9a2b05bd3d
(cua-delete-selection, cua-toggle-set-mark): New defcustoms.
Kim F. Storm <storm@cua.dk>
parents:
70799
diff
changeset
|
434 (const :tag "Alt key" alt) |
8e9a2b05bd3d
(cua-delete-selection, cua-toggle-set-mark): New defcustoms.
Kim F. Storm <storm@cua.dk>
parents:
70799
diff
changeset
|
435 (const :tag "Hyper key" hyper) |
67405
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
436 (const :tag "Super key" super)) |
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
437 :group 'cua) |
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
438 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
439 (defcustom cua-enable-rectangle-auto-help t |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
440 "If non-nil, automatically show help for region, rectangle and global mark." |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
441 :type 'boolean |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
442 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
443 |
63073
f1bf3660220e
* emulation/cua-base.el (cua-rectangle, cua-rectangle-noselect)
Kim F. Storm <storm@cua.dk>
parents:
62449
diff
changeset
|
444 (defface cua-rectangle |
61509 | 445 '((default :inherit region) |
446 (((class color)) :foreground "white" :background "maroon")) | |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
447 "Font used by CUA for highlighting the rectangle." |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
448 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
449 |
63073
f1bf3660220e
* emulation/cua-base.el (cua-rectangle, cua-rectangle-noselect)
Kim F. Storm <storm@cua.dk>
parents:
62449
diff
changeset
|
450 (defface cua-rectangle-noselect |
61509 | 451 '((default :inherit region) |
452 (((class color)) :foreground "white" :background "dimgray")) | |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
453 "Font used by CUA for highlighting the non-selected rectangle lines." |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
454 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
455 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
456 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
457 ;;; Global Mark Customization |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
458 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
459 (defcustom cua-global-mark-keep-visible t |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
460 "If non-nil, always keep global mark visible in other window." |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
461 :type 'boolean |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
462 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
463 |
63073
f1bf3660220e
* emulation/cua-base.el (cua-rectangle, cua-rectangle-noselect)
Kim F. Storm <storm@cua.dk>
parents:
62449
diff
changeset
|
464 (defface cua-global-mark |
61587
15ece4eaca8d
(cua-global-mark-face): Add special case
Dan Nicolaescu <dann@ics.uci.edu>
parents:
61509
diff
changeset
|
465 '((((min-colors 88)(class color)) :foreground "black" :background "yellow1") |
15ece4eaca8d
(cua-global-mark-face): Add special case
Dan Nicolaescu <dann@ics.uci.edu>
parents:
61509
diff
changeset
|
466 (((class color)) :foreground "black" :background "yellow") |
61509 | 467 (t :bold t)) |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
468 "Font used by CUA for highlighting the global mark." |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
469 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
470 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
471 (defcustom cua-global-mark-blink-cursor-interval 0.20 |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
472 "Blink cursor at this interval when global mark is active." |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
473 :type '(choice (number :tag "Blink interval") |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
474 (const :tag "No blink" nil)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
475 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
476 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
477 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
478 ;;; Cursor Indication Customization |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
479 |
45278
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
480 (defcustom cua-enable-cursor-indications nil |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
481 "If non-nil, use different cursor colors for indications." |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
482 :type 'boolean |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
483 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
484 |
47777
6a7ae10d9c96
(cua-normal-cursor-color): Fixed
Kim F. Storm <storm@cua.dk>
parents:
45954
diff
changeset
|
485 (defcustom cua-normal-cursor-color (or (and (boundp 'initial-cursor-color) initial-cursor-color) |
6a7ae10d9c96
(cua-normal-cursor-color): Fixed
Kim F. Storm <storm@cua.dk>
parents:
45954
diff
changeset
|
486 (and (boundp 'initial-frame-alist) |
6a7ae10d9c96
(cua-normal-cursor-color): Fixed
Kim F. Storm <storm@cua.dk>
parents:
45954
diff
changeset
|
487 (assoc 'cursor-color initial-frame-alist) |
6a7ae10d9c96
(cua-normal-cursor-color): Fixed
Kim F. Storm <storm@cua.dk>
parents:
45954
diff
changeset
|
488 (cdr (assoc 'cursor-color initial-frame-alist))) |
6a7ae10d9c96
(cua-normal-cursor-color): Fixed
Kim F. Storm <storm@cua.dk>
parents:
45954
diff
changeset
|
489 (and (boundp 'default-frame-alist) |
6a7ae10d9c96
(cua-normal-cursor-color): Fixed
Kim F. Storm <storm@cua.dk>
parents:
45954
diff
changeset
|
490 (assoc 'cursor-color default-frame-alist) |
6a7ae10d9c96
(cua-normal-cursor-color): Fixed
Kim F. Storm <storm@cua.dk>
parents:
45954
diff
changeset
|
491 (cdr (assoc 'cursor-color default-frame-alist))) |
6a7ae10d9c96
(cua-normal-cursor-color): Fixed
Kim F. Storm <storm@cua.dk>
parents:
45954
diff
changeset
|
492 (frame-parameter nil 'cursor-color) |
6a7ae10d9c96
(cua-normal-cursor-color): Fixed
Kim F. Storm <storm@cua.dk>
parents:
45954
diff
changeset
|
493 "red") |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
494 "Normal (non-overwrite) cursor color. |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
495 Default is to load cursor color from initial or default frame parameters. |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
496 |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
497 If the value is a COLOR name, then only the `cursor-color' attribute will be |
55271
d7007197f057
Change cursor-type block to hollow.
Kim F. Storm <storm@cua.dk>
parents:
55267
diff
changeset
|
498 affected. If the value is a cursor TYPE (one of: box, hollow, bar, or hbar), |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
499 then only the `cursor-type' property will be affected. If the value is |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
500 a cons (TYPE . COLOR), then both properties are affected." |
47777
6a7ae10d9c96
(cua-normal-cursor-color): Fixed
Kim F. Storm <storm@cua.dk>
parents:
45954
diff
changeset
|
501 :initialize 'custom-initialize-default |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
502 :type '(choice |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
503 (color :tag "Color") |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
504 (choice :tag "Type" |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
505 (const :tag "Filled box" box) |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
506 (const :tag "Vertical bar" bar) |
63180
78264fe43c01
(cua-normal-cursor-color, cua-read-only-cursor-color,
Juanma Barranquero <lekktu@gmail.com>
parents:
63073
diff
changeset
|
507 (const :tag "Horizontal bar" hbar) |
55271
d7007197f057
Change cursor-type block to hollow.
Kim F. Storm <storm@cua.dk>
parents:
55267
diff
changeset
|
508 (const :tag "Hollow box" hollow)) |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
509 (cons :tag "Color and Type" |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
510 (choice :tag "Type" |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
511 (const :tag "Filled box" box) |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
512 (const :tag "Vertical bar" bar) |
63180
78264fe43c01
(cua-normal-cursor-color, cua-read-only-cursor-color,
Juanma Barranquero <lekktu@gmail.com>
parents:
63073
diff
changeset
|
513 (const :tag "Horizontal bar" hbar) |
55271
d7007197f057
Change cursor-type block to hollow.
Kim F. Storm <storm@cua.dk>
parents:
55267
diff
changeset
|
514 (const :tag "Hollow box" hollow)) |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
515 (color :tag "Color"))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
516 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
517 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
518 (defcustom cua-read-only-cursor-color "darkgreen" |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
519 "Cursor color used in read-only buffers, if non-nil. |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
520 Only used when `cua-enable-cursor-indications' is non-nil. |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
521 |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
522 If the value is a COLOR name, then only the `cursor-color' attribute will be |
55271
d7007197f057
Change cursor-type block to hollow.
Kim F. Storm <storm@cua.dk>
parents:
55267
diff
changeset
|
523 affected. If the value is a cursor TYPE (one of: box, hollow, bar, or hbar), |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
524 then only the `cursor-type' property will be affected. If the value is |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
525 a cons (TYPE . COLOR), then both properties are affected." |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
526 :type '(choice |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
527 (color :tag "Color") |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
528 (choice :tag "Type" |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
529 (const :tag "Filled box" box) |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
530 (const :tag "Vertical bar" bar) |
63180
78264fe43c01
(cua-normal-cursor-color, cua-read-only-cursor-color,
Juanma Barranquero <lekktu@gmail.com>
parents:
63073
diff
changeset
|
531 (const :tag "Horizontal bar" hbar) |
55271
d7007197f057
Change cursor-type block to hollow.
Kim F. Storm <storm@cua.dk>
parents:
55267
diff
changeset
|
532 (const :tag "Hollow box" hollow)) |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
533 (cons :tag "Color and Type" |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
534 (choice :tag "Type" |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
535 (const :tag "Filled box" box) |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
536 (const :tag "Vertical bar" bar) |
63180
78264fe43c01
(cua-normal-cursor-color, cua-read-only-cursor-color,
Juanma Barranquero <lekktu@gmail.com>
parents:
63073
diff
changeset
|
537 (const :tag "Horizontal bar" hbar) |
55271
d7007197f057
Change cursor-type block to hollow.
Kim F. Storm <storm@cua.dk>
parents:
55267
diff
changeset
|
538 (const :tag "Hollow box" hollow)) |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
539 (color :tag "Color"))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
540 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
541 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
542 (defcustom cua-overwrite-cursor-color "yellow" |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
543 "Cursor color used when overwrite mode is set, if non-nil. |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
544 Only used when `cua-enable-cursor-indications' is non-nil. |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
545 |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
546 If the value is a COLOR name, then only the `cursor-color' attribute will be |
55271
d7007197f057
Change cursor-type block to hollow.
Kim F. Storm <storm@cua.dk>
parents:
55267
diff
changeset
|
547 affected. If the value is a cursor TYPE (one of: box, hollow, bar, or hbar), |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
548 then only the `cursor-type' property will be affected. If the value is |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
549 a cons (TYPE . COLOR), then both properties are affected." |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
550 :type '(choice |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
551 (color :tag "Color") |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
552 (choice :tag "Type" |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
553 (const :tag "Filled box" box) |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
554 (const :tag "Vertical bar" bar) |
63180
78264fe43c01
(cua-normal-cursor-color, cua-read-only-cursor-color,
Juanma Barranquero <lekktu@gmail.com>
parents:
63073
diff
changeset
|
555 (const :tag "Horizontal bar" hbar) |
55271
d7007197f057
Change cursor-type block to hollow.
Kim F. Storm <storm@cua.dk>
parents:
55267
diff
changeset
|
556 (const :tag "Hollow box" hollow)) |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
557 (cons :tag "Color and Type" |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
558 (choice :tag "Type" |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
559 (const :tag "Filled box" box) |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
560 (const :tag "Vertical bar" bar) |
63180
78264fe43c01
(cua-normal-cursor-color, cua-read-only-cursor-color,
Juanma Barranquero <lekktu@gmail.com>
parents:
63073
diff
changeset
|
561 (const :tag "Horizontal bar" hbar) |
55271
d7007197f057
Change cursor-type block to hollow.
Kim F. Storm <storm@cua.dk>
parents:
55267
diff
changeset
|
562 (const :tag "Hollow box" hollow)) |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
563 (color :tag "Color"))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
564 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
565 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
566 (defcustom cua-global-mark-cursor-color "cyan" |
110494
7c4da622f181
Remove leading `*' from docs of some defcustoms etc.
Glenn Morris <rgm@gnu.org>
parents:
109302
diff
changeset
|
567 "Indication for active global mark. |
54851 | 568 Will change cursor color to specified color if string. |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
569 Only used when `cua-enable-cursor-indications' is non-nil. |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
570 |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
571 If the value is a COLOR name, then only the `cursor-color' attribute will be |
55271
d7007197f057
Change cursor-type block to hollow.
Kim F. Storm <storm@cua.dk>
parents:
55267
diff
changeset
|
572 affected. If the value is a cursor TYPE (one of: box, hollow, bar, or hbar), |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
573 then only the `cursor-type' property will be affected. If the value is |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
574 a cons (TYPE . COLOR), then both properties are affected." |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
575 :type '(choice |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
576 (color :tag "Color") |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
577 (choice :tag "Type" |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
578 (const :tag "Filled box" box) |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
579 (const :tag "Vertical bar" bar) |
63180
78264fe43c01
(cua-normal-cursor-color, cua-read-only-cursor-color,
Juanma Barranquero <lekktu@gmail.com>
parents:
63073
diff
changeset
|
580 (const :tag "Horizontal bar" hbar) |
55271
d7007197f057
Change cursor-type block to hollow.
Kim F. Storm <storm@cua.dk>
parents:
55267
diff
changeset
|
581 (const :tag "Hollow box" hollow)) |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
582 (cons :tag "Color and Type" |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
583 (choice :tag "Type" |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
584 (const :tag "Filled box" box) |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
585 (const :tag "Vertical bar" bar) |
63180
78264fe43c01
(cua-normal-cursor-color, cua-read-only-cursor-color,
Juanma Barranquero <lekktu@gmail.com>
parents:
63073
diff
changeset
|
586 (const :tag "Horizontal bar" hbar) |
55271
d7007197f057
Change cursor-type block to hollow.
Kim F. Storm <storm@cua.dk>
parents:
55267
diff
changeset
|
587 (const :tag "Hollow box" hollow)) |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
588 (color :tag "Color"))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
589 :group 'cua) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
590 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
591 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
592 ;;; Rectangle support is in cua-rect.el |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
593 |
87021
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
594 (autoload 'cua-set-rectangle-mark "cua-rect" |
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
595 "Start rectangle at mouse click position." t nil) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
596 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
597 ;; Stub definitions until it is loaded |
87021
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
598 (defvar cua--rectangle) |
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
599 (defvar cua--last-killed-rectangle) |
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
600 (unless (featurep 'cua-rect) |
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
601 (setq cua--rectangle nil |
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
602 cua--last-killed-rectangle nil)) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
603 |
87021
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
604 ;; All behind cua--rectangle tests. |
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
605 (declare-function cua-copy-rectangle "cua-rect" (arg)) |
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
606 (declare-function cua-cut-rectangle "cua-rect" (arg)) |
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
607 (declare-function cua--rectangle-left "cua-rect" (&optional val)) |
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
608 (declare-function cua--delete-rectangle "cua-rect" ()) |
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
609 (declare-function cua--insert-rectangle "cua-rect" |
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
610 (rect &optional below paste-column line-count)) |
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
611 (declare-function cua--rectangle-corner "cua-rect" (&optional advance)) |
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
612 (declare-function cua--rectangle-assert "cua-rect" ()) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
613 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
614 ;;; Global Mark support is in cua-gmrk.el |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
615 |
65896
7cc413612d3d
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
Romain Francoise <romain@orebokech.com>
parents:
65726
diff
changeset
|
616 (autoload 'cua-toggle-global-mark "cua-gmrk" nil t nil) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
617 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
618 ;; Stub definitions until cua-gmrk.el is loaded |
87021
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
619 (defvar cua--global-mark-active) |
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
620 (unless (featurep 'cua-gmrk) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
621 (setq cua--global-mark-active nil)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
622 |
87021
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
623 (declare-function cua--insert-at-global-mark "cua-gmrk" (str &optional msg)) |
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
624 (declare-function cua--global-mark-post-command "cua-gmrk" ()) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
625 |
45074
d57f600f5b7e
(cua-inhibit-cua-keys): New buffer-local variable.
Kim F. Storm <storm@cua.dk>
parents:
45062
diff
changeset
|
626 |
d57f600f5b7e
(cua-inhibit-cua-keys): New buffer-local variable.
Kim F. Storm <storm@cua.dk>
parents:
45062
diff
changeset
|
627 ;;; Low-level Interface |
d57f600f5b7e
(cua-inhibit-cua-keys): New buffer-local variable.
Kim F. Storm <storm@cua.dk>
parents:
45062
diff
changeset
|
628 |
d57f600f5b7e
(cua-inhibit-cua-keys): New buffer-local variable.
Kim F. Storm <storm@cua.dk>
parents:
45062
diff
changeset
|
629 (defvar cua-inhibit-cua-keys nil |
63869
e7c533a3b1b9
(cua-check-pending-input, cua-repeat-replace-region, cua-mode, cua-debug,
Juanma Barranquero <lekktu@gmail.com>
parents:
63388
diff
changeset
|
630 "Buffer-local variable that may disable the CUA keymappings.") |
45074
d57f600f5b7e
(cua-inhibit-cua-keys): New buffer-local variable.
Kim F. Storm <storm@cua.dk>
parents:
45062
diff
changeset
|
631 (make-variable-buffer-local 'cua-inhibit-cua-keys) |
d57f600f5b7e
(cua-inhibit-cua-keys): New buffer-local variable.
Kim F. Storm <storm@cua.dk>
parents:
45062
diff
changeset
|
632 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
633 ;;; Aux. variables |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
634 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
635 ;; Current region was started using cua-set-mark. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
636 (defvar cua--explicit-region-start nil) |
64989
6b11882571cb
(cua-delete-region): Return t if
Kim F. Storm <storm@cua.dk>
parents:
64701
diff
changeset
|
637 (make-variable-buffer-local 'cua--explicit-region-start) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
638 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
639 ;; Latest region was started using shifted movement command. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
640 (defvar cua--last-region-shifted nil) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
641 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
642 ;; buffer + point prior to current command when rectangle is active |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
643 ;; checked in post-command hook to see if point was moved |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
644 (defvar cua--buffer-and-point-before-command nil) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
645 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
646 ;; status string for mode line indications |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
647 (defvar cua--status-string nil) |
64989
6b11882571cb
(cua-delete-region): Return t if
Kim F. Storm <storm@cua.dk>
parents:
64701
diff
changeset
|
648 (make-variable-buffer-local 'cua--status-string) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
649 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
650 (defvar cua--debug nil) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
651 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
652 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
653 ;;; Prefix key override mechanism |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
654 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
655 ;; The prefix override (when mark-active) operates in three substates: |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
656 ;; [1] Before using a prefix key |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
657 ;; [2] Immediately after using a prefix key |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
658 ;; [3] A fraction of a second later |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
659 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
660 ;; In state [1], the cua--prefix-override-keymap is active. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
661 ;; This keymap binds the C-x and C-c prefix keys to the |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
662 ;; cua--prefix-override-handler function. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
663 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
664 ;; When a prefix key is typed in state [1], cua--prefix-override-handler |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
665 ;; will push back the keys already read to the event queue. If input is |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
666 ;; pending, it changes directly to state [3]. Otherwise, a short timer [T] |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
667 ;; is started, and it changes to state [2]. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
668 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
669 ;; In state [2], the cua--prefix-override-keymap is inactive. Instead the |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
670 ;; cua--prefix-repeat-keymap is active. This keymap binds C-c C-c and C-x |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
671 ;; C-x to the cua--prefix-repeat-handler function. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
672 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
673 ;; If the prefix key is repeated in state [2], cua--prefix-repeat-handler |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
674 ;; will cancel [T], back the keys already read (except for the second prefix |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
675 ;; keys) to the event queue, and changes to state [3]. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
676 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
677 ;; The basic cua--cua-keys-keymap binds [C-x timeout] to kill-region and |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
678 ;; [C-c timeout] to copy-region-as-kill, so if [T] times out in state [2], |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
679 ;; the cua--prefix-override-timeout function will push a `timeout' event on |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
680 ;; the event queue, and changes to state [3]. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
681 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
682 ;; In state [3] both cua--prefix-override-keymap and cua--prefix-repeat-keymap |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
683 ;; are inactive, so the timeout in cua-global-keymap binding is used, or the |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
684 ;; normal prefix key binding from the global or local map will be used. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
685 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
686 ;; The pre-command hook (executed as a consequence of the timeout or normal |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
687 ;; prefix key binding) will cancel [T] and change from state [3] back to |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
688 ;; state [1]. So cua--prefix-override-handler and cua--prefix-repeat-handler |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
689 ;; are always called with state reset to [1]! |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
690 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
691 ;; State [1] is recognized by cua--prefix-override-timer is nil, |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
692 ;; state [2] is recognized by cua--prefix-override-timer is a timer, and |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
693 ;; state [3] is recognized by cua--prefix-override-timer is t. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
694 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
695 (defvar cua--prefix-override-timer nil) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
696 (defvar cua--prefix-override-length nil) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
697 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
698 (defun cua--prefix-override-replay (arg repeat) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
699 (let* ((keys (this-command-keys)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
700 (i (length keys)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
701 (key (aref keys (1- i)))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
702 (setq cua--prefix-override-length (- i repeat)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
703 (setq cua--prefix-override-timer |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
704 (or |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
705 ;; In state [2], change to state [3] |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
706 (> repeat 0) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
707 ;; In state [1], change directly to state [3] |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
708 (and cua-check-pending-input (input-pending-p)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
709 ;; In state [1], [T] disabled, so change to state [3] |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
710 (not (numberp cua-prefix-override-inhibit-delay)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
711 (<= cua-prefix-override-inhibit-delay 0) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
712 ;; In state [1], start [T] and change to state [2] |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
713 (run-with-timer cua-prefix-override-inhibit-delay nil |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
714 'cua--prefix-override-timeout))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
715 ;; Don't record this command |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
716 (setq this-command last-command) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
717 ;; Restore the prefix arg |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
718 (setq prefix-arg arg) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
719 (reset-this-command-lengths) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
720 ;; Push the key back on the event queue |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
721 (setq unread-command-events (cons key unread-command-events)))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
722 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
723 (defun cua--prefix-override-handler (arg) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
724 "Start timer waiting for prefix key to be followed by another key. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
725 Repeating prefix key when region is active works as a single prefix key." |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
726 (interactive "P") |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
727 (cua--prefix-override-replay arg 0)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
728 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
729 (defun cua--prefix-repeat-handler (arg) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
730 "Repeating prefix key when region is active works as a single prefix key." |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
731 (interactive "P") |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
732 (cua--prefix-override-replay arg 1)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
733 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
734 (defun cua--prefix-copy-handler (arg) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
735 "Copy region/rectangle, then replay last key." |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
736 (interactive "P") |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
737 (if cua--rectangle |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
738 (cua-copy-rectangle arg) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
739 (cua-copy-region arg)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
740 (let ((keys (this-single-command-keys))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
741 (setq unread-command-events |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
742 (cons (aref keys (1- (length keys))) unread-command-events)))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
743 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
744 (defun cua--prefix-cut-handler (arg) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
745 "Cut region/rectangle, then replay last key." |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
746 (interactive "P") |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
747 (if cua--rectangle |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
748 (cua-cut-rectangle arg) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
749 (cua-cut-region arg)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
750 (let ((keys (this-single-command-keys))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
751 (setq unread-command-events |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
752 (cons (aref keys (1- (length keys))) unread-command-events)))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
753 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
754 (defun cua--prefix-override-timeout () |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
755 (setq cua--prefix-override-timer t) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
756 (when (= (length (this-command-keys)) cua--prefix-override-length) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
757 (setq unread-command-events (cons 'timeout unread-command-events)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
758 (if prefix-arg |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
759 (reset-this-command-lengths) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
760 (setq overriding-terminal-local-map nil)) |
45225
76c3f51638bd
(cua-mode): Misc. changes to use
Kim F. Storm <storm@cua.dk>
parents:
45074
diff
changeset
|
761 (cua--select-keymaps))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
762 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
763 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
764 ;;; Aux. functions |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
765 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
766 (defun cua--fallback () |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
767 ;; Execute original command |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
768 (setq this-command this-original-command) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
769 (call-interactively this-command)) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
770 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
771 (defun cua--keep-active () |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
772 (setq mark-active t |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
773 deactivate-mark nil)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
774 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
775 (defun cua--deactivate (&optional now) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
776 (setq cua--explicit-region-start nil) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
777 (if (not now) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
778 (setq deactivate-mark t) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
779 (setq mark-active nil) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
780 (run-hooks 'deactivate-mark-hook))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
781 |
108467
114b70461f96
CUA mode: Fix use of `filter-buffer-substring' (rework previous change).
Juanma Barranquero <lekktu@gmail.com>
parents:
108276
diff
changeset
|
782 (defun cua--filter-buffer-noprops (start end) |
114b70461f96
CUA mode: Fix use of `filter-buffer-substring' (rework previous change).
Juanma Barranquero <lekktu@gmail.com>
parents:
108276
diff
changeset
|
783 (let ((str (filter-buffer-substring start end))) |
114b70461f96
CUA mode: Fix use of `filter-buffer-substring' (rework previous change).
Juanma Barranquero <lekktu@gmail.com>
parents:
108276
diff
changeset
|
784 (set-text-properties 0 (length str) nil str) |
114b70461f96
CUA mode: Fix use of `filter-buffer-substring' (rework previous change).
Juanma Barranquero <lekktu@gmail.com>
parents:
108276
diff
changeset
|
785 str)) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
786 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
787 ;; The current register prefix |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
788 (defvar cua--register nil) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
789 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
790 (defun cua--prefix-arg (arg) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
791 (setq cua--register |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
792 (and cua-enable-register-prefix |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
793 (integerp arg) (>= arg 0) (< arg 10) |
45952
ec1df96b1c23
(cua--prefix-arg): Make register prefixes
Kim F. Storm <storm@cua.dk>
parents:
45597
diff
changeset
|
794 (let* ((prefix (aref (this-command-keys) 0)) |
ec1df96b1c23
(cua--prefix-arg): Make register prefixes
Kim F. Storm <storm@cua.dk>
parents:
45597
diff
changeset
|
795 (ctrl-u-prefix (and (integerp prefix) |
45954 | 796 (= prefix ?\C-u)))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
797 (cond |
45954 | 798 ((eq cua-enable-register-prefix 'not-ctrl-u) |
799 (not ctrl-u-prefix)) | |
800 ((eq cua-enable-register-prefix 'ctrl-u-only) | |
801 ctrl-u-prefix) | |
802 (t t))) | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
803 (+ arg ?0))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
804 (if cua--register nil arg)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
805 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
806 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
807 ;;; Region specific commands |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
808 |
45597
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
809 (defvar cua--last-deleted-region-pos nil) |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
810 (defvar cua--last-deleted-region-text nil) |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
811 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
812 (defun cua-delete-region () |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
813 "Delete the active region. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
814 Save a copy in register 0 if `cua-delete-copy-to-register-0' is non-nil." |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
815 (interactive) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
816 (let ((start (mark)) (end (point))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
817 (or (<= start end) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
818 (setq start (prog1 end (setq end start)))) |
69900
2bf5f807797c
(cua-delete-region, cua-paste)
Kim F. Storm <storm@cua.dk>
parents:
69668
diff
changeset
|
819 (setq cua--last-deleted-region-text (filter-buffer-substring start end)) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
820 (if cua-delete-copy-to-register-0 |
45597
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
821 (set-register ?0 cua--last-deleted-region-text)) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
822 (delete-region start end) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
823 (setq cua--last-deleted-region-pos |
45597
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
824 (cons (current-buffer) |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
825 (and (consp buffer-undo-list) |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
826 (car buffer-undo-list)))) |
64989
6b11882571cb
(cua-delete-region): Return t if
Kim F. Storm <storm@cua.dk>
parents:
64701
diff
changeset
|
827 (cua--deactivate) |
6b11882571cb
(cua-delete-region): Return t if
Kim F. Storm <storm@cua.dk>
parents:
64701
diff
changeset
|
828 (/= start end))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
829 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
830 (defun cua-replace-region () |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
831 "Replace the active region with the character you type." |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
832 (interactive) |
71905
8e9a2b05bd3d
(cua-delete-selection, cua-toggle-set-mark): New defcustoms.
Kim F. Storm <storm@cua.dk>
parents:
70799
diff
changeset
|
833 (let ((not-empty (and cua-delete-selection (cua-delete-region)))) |
64989
6b11882571cb
(cua-delete-region): Return t if
Kim F. Storm <storm@cua.dk>
parents:
64701
diff
changeset
|
834 (unless (eq this-original-command this-command) |
6b11882571cb
(cua-delete-region): Return t if
Kim F. Storm <storm@cua.dk>
parents:
64701
diff
changeset
|
835 (let ((overwrite-mode |
6b11882571cb
(cua-delete-region): Return t if
Kim F. Storm <storm@cua.dk>
parents:
64701
diff
changeset
|
836 (and overwrite-mode |
6b11882571cb
(cua-delete-region): Return t if
Kim F. Storm <storm@cua.dk>
parents:
64701
diff
changeset
|
837 not-empty |
6b11882571cb
(cua-delete-region): Return t if
Kim F. Storm <storm@cua.dk>
parents:
64701
diff
changeset
|
838 (not (eq this-original-command 'self-insert-command))))) |
6b11882571cb
(cua-delete-region): Return t if
Kim F. Storm <storm@cua.dk>
parents:
64701
diff
changeset
|
839 (cua--fallback))))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
840 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
841 (defun cua-copy-region (arg) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
842 "Copy the region to the kill ring. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
843 With numeric prefix arg, copy to register 0-9 instead." |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
844 (interactive "P") |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
845 (setq arg (cua--prefix-arg arg)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
846 (setq cua--last-killed-rectangle nil) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
847 (let ((start (mark)) (end (point))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
848 (or (<= start end) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
849 (setq start (prog1 end (setq end start)))) |
62184
d2e6a54e6fb1
(cua-copy-region, cua-cut-region)
Kim F. Storm <storm@cua.dk>
parents:
62023
diff
changeset
|
850 (cond |
d2e6a54e6fb1
(cua-copy-region, cua-cut-region)
Kim F. Storm <storm@cua.dk>
parents:
62023
diff
changeset
|
851 (cua--register |
d2e6a54e6fb1
(cua-copy-region, cua-cut-region)
Kim F. Storm <storm@cua.dk>
parents:
62023
diff
changeset
|
852 (copy-to-register cua--register start end nil)) |
d2e6a54e6fb1
(cua-copy-region, cua-cut-region)
Kim F. Storm <storm@cua.dk>
parents:
62023
diff
changeset
|
853 ((eq this-original-command 'clipboard-kill-ring-save) |
d2e6a54e6fb1
(cua-copy-region, cua-cut-region)
Kim F. Storm <storm@cua.dk>
parents:
62023
diff
changeset
|
854 (clipboard-kill-ring-save start end)) |
d2e6a54e6fb1
(cua-copy-region, cua-cut-region)
Kim F. Storm <storm@cua.dk>
parents:
62023
diff
changeset
|
855 (t |
d2e6a54e6fb1
(cua-copy-region, cua-cut-region)
Kim F. Storm <storm@cua.dk>
parents:
62023
diff
changeset
|
856 (copy-region-as-kill start end))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
857 (if cua-keep-region-after-copy |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
858 (cua--keep-active) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
859 (cua--deactivate)))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
860 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
861 (defun cua-cut-region (arg) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
862 "Cut the region and copy to the kill ring. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
863 With numeric prefix arg, copy to register 0-9 instead." |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
864 (interactive "P") |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
865 (setq cua--last-killed-rectangle nil) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
866 (if buffer-read-only |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
867 (cua-copy-region arg) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
868 (setq arg (cua--prefix-arg arg)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
869 (let ((start (mark)) (end (point))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
870 (or (<= start end) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
871 (setq start (prog1 end (setq end start)))) |
62184
d2e6a54e6fb1
(cua-copy-region, cua-cut-region)
Kim F. Storm <storm@cua.dk>
parents:
62023
diff
changeset
|
872 (cond |
d2e6a54e6fb1
(cua-copy-region, cua-cut-region)
Kim F. Storm <storm@cua.dk>
parents:
62023
diff
changeset
|
873 (cua--register |
d2e6a54e6fb1
(cua-copy-region, cua-cut-region)
Kim F. Storm <storm@cua.dk>
parents:
62023
diff
changeset
|
874 (copy-to-register cua--register start end t)) |
d2e6a54e6fb1
(cua-copy-region, cua-cut-region)
Kim F. Storm <storm@cua.dk>
parents:
62023
diff
changeset
|
875 ((eq this-original-command 'clipboard-kill-region) |
d2e6a54e6fb1
(cua-copy-region, cua-cut-region)
Kim F. Storm <storm@cua.dk>
parents:
62023
diff
changeset
|
876 (clipboard-kill-region start end)) |
d2e6a54e6fb1
(cua-copy-region, cua-cut-region)
Kim F. Storm <storm@cua.dk>
parents:
62023
diff
changeset
|
877 (t |
d2e6a54e6fb1
(cua-copy-region, cua-cut-region)
Kim F. Storm <storm@cua.dk>
parents:
62023
diff
changeset
|
878 (kill-region start end)))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
879 (cua--deactivate))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
880 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
881 ;;; Generic commands for regions, rectangles, and global marks |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
882 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
883 (defun cua-cancel () |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
884 "Cancel the active region, rectangle, or global mark." |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
885 (interactive) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
886 (setq mark-active nil) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
887 (setq cua--explicit-region-start nil) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
888 (if (fboundp 'cua--cancel-rectangle) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
889 (cua--cancel-rectangle))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
890 |
86346
605b05ee020f
(x-clipboard-yank): Fix declaration.
Glenn Morris <rgm@gnu.org>
parents:
86326
diff
changeset
|
891 (declare-function x-clipboard-yank "../term/x-win" ()) |
86326
4b0440ce239b
(x-clipboard-yank): Declare as function.
Juanma Barranquero <lekktu@gmail.com>
parents:
86102
diff
changeset
|
892 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
893 (defun cua-paste (arg) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
894 "Paste last cut or copied region or rectangle. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
895 An active region is deleted before executing the command. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
896 With numeric prefix arg, paste from register 0-9 instead. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
897 If global mark is active, copy from register or one character." |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
898 (interactive "P") |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
899 (setq arg (cua--prefix-arg arg)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
900 (let ((regtxt (and cua--register (get-register cua--register))) |
56839
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
901 (count (prefix-numeric-value arg)) |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
902 paste-column paste-lines) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
903 (cond |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
904 ((and cua--register (not regtxt)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
905 (message "Nothing in register %c" cua--register)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
906 (cua--global-mark-active |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
907 (if regtxt |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
908 (cua--insert-at-global-mark regtxt) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
909 (when (not (eobp)) |
69900
2bf5f807797c
(cua-delete-region, cua-paste)
Kim F. Storm <storm@cua.dk>
parents:
69668
diff
changeset
|
910 (cua--insert-at-global-mark (filter-buffer-substring (point) (+ (point) count))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
911 (forward-char count)))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
912 (buffer-read-only |
93053
f62cf4851fe9
(cua-paste): Signal an error in read-only buf.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92357
diff
changeset
|
913 (error "Cannot paste into a read-only buffer")) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
914 (t |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
915 ;; Must save register here, since delete may override reg 0. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
916 (if mark-active |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
917 (if cua--rectangle |
56839
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
918 (progn |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
919 (goto-char (min (mark) (point))) |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
920 (setq paste-column (cua--rectangle-left)) |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
921 (setq paste-lines (cua--delete-rectangle)) |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
922 (if (= paste-lines 1) |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
923 (setq paste-lines nil))) ;; paste all |
81895
d59242324437
(cua-paste): Before a yank command,
Juri Linkov <juri@jurta.org>
parents:
76132
diff
changeset
|
924 ;; Before a yank command, make sure we don't yank the |
d59242324437
(cua-paste): Before a yank command,
Juri Linkov <juri@jurta.org>
parents:
76132
diff
changeset
|
925 ;; head of the kill-ring that really comes from the |
82508
0c55974f55f5
(cua-paste): Use `mouse-region-match' instead of checking last-command.
Juri Linkov <juri@jurta.org>
parents:
82376
diff
changeset
|
926 ;; currently active region we are going to delete. |
0c55974f55f5
(cua-paste): Use `mouse-region-match' instead of checking last-command.
Juri Linkov <juri@jurta.org>
parents:
82376
diff
changeset
|
927 ;; That would make yank a no-op. |
81895
d59242324437
(cua-paste): Before a yank command,
Juri Linkov <juri@jurta.org>
parents:
76132
diff
changeset
|
928 (if (and (string= (filter-buffer-substring (point) (mark)) |
d59242324437
(cua-paste): Before a yank command,
Juri Linkov <juri@jurta.org>
parents:
76132
diff
changeset
|
929 (car kill-ring)) |
85074
16efb39cdb2e
(cua-paste): Check if mouse-region-match is fbound
Juri Linkov <juri@jurta.org>
parents:
83676
diff
changeset
|
930 (fboundp 'mouse-region-match) |
82508
0c55974f55f5
(cua-paste): Use `mouse-region-match' instead of checking last-command.
Juri Linkov <juri@jurta.org>
parents:
82376
diff
changeset
|
931 (mouse-region-match)) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
932 (current-kill 1)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
933 (cua-delete-region))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
934 (cond |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
935 (regtxt |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
936 (cond |
87021
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
937 ;; This being a cons implies cua-rect is loaded? |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
938 ((consp regtxt) (cua--insert-rectangle regtxt)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
939 ((stringp regtxt) (insert-for-yank regtxt)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
940 (t (message "Unknown data in register %c" cua--register)))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
941 ((and cua--last-killed-rectangle |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
942 (eq (and kill-ring (car kill-ring)) (car cua--last-killed-rectangle))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
943 (let ((pt (point))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
944 (when (not (eq buffer-undo-list t)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
945 (setq this-command 'cua--paste-rectangle) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
946 (undo-boundary) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
947 (setq buffer-undo-list (cons pt buffer-undo-list))) |
56839
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
948 (cua--insert-rectangle (cdr cua--last-killed-rectangle) |
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
949 nil paste-column paste-lines) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
950 (if arg (goto-char pt)))) |
62184
d2e6a54e6fb1
(cua-copy-region, cua-cut-region)
Kim F. Storm <storm@cua.dk>
parents:
62023
diff
changeset
|
951 ((eq this-original-command 'clipboard-yank) |
d2e6a54e6fb1
(cua-copy-region, cua-cut-region)
Kim F. Storm <storm@cua.dk>
parents:
62023
diff
changeset
|
952 (clipboard-yank)) |
76132
0d644f70ff05
(cua-paste): Handle x-clipboard-yank.
Kim F. Storm <storm@cua.dk>
parents:
75488
diff
changeset
|
953 ((eq this-original-command 'x-clipboard-yank) |
0d644f70ff05
(cua-paste): Handle x-clipboard-yank.
Kim F. Storm <storm@cua.dk>
parents:
75488
diff
changeset
|
954 (x-clipboard-yank)) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
955 (t (yank arg))))))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
956 |
74365
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
957 |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
958 ;; cua-paste-pop-rotate-temporarily == t mechanism: |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
959 ;; |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
960 ;; C-y M-y M-y => only rotates kill ring temporarily, |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
961 ;; so next C-y yanks what previous C-y yanked, |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
962 ;; |
74454
7d244d3c8089
(cua-paste-pop-rotate-temporarily): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
74365
diff
changeset
|
963 ;; M-y M-y M-y => equivalent to C-y M-y M-y |
7d244d3c8089
(cua-paste-pop-rotate-temporarily): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
74365
diff
changeset
|
964 ;; |
7d244d3c8089
(cua-paste-pop-rotate-temporarily): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
74365
diff
changeset
|
965 ;; But: After another command, C-u M-y remembers the temporary |
74365
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
966 ;; kill-ring position, so |
74454
7d244d3c8089
(cua-paste-pop-rotate-temporarily): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
74365
diff
changeset
|
967 ;; C-u M-y => yanks what the last M-y yanked |
74365
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
968 ;; |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
969 |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
970 (defvar cua-paste-pop-count nil) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
971 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
972 (defun cua-paste-pop (arg) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
973 "Replace a just-pasted text or rectangle with a different text. |
79409
5228ca1272a5
(cua-highlight-region-shift-only, cua-paste-pop): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
78551
diff
changeset
|
974 See `yank-pop' for details about the default behavior. For an alternative |
5228ca1272a5
(cua-highlight-region-shift-only, cua-paste-pop): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
78551
diff
changeset
|
975 behavior, see `cua-paste-pop-rotate-temporarily'." |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
976 (interactive "P") |
74365
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
977 (cond |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
978 ((eq last-command 'cua--paste-rectangle) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
979 (undo) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
980 (yank arg)) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
981 ((not cua-paste-pop-rotate-temporarily) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
982 (yank-pop (prefix-numeric-value arg))) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
983 (t |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
984 (let ((rotate (if (consp arg) 1 (prefix-numeric-value arg)))) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
985 (cond |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
986 ((or (null cua-paste-pop-count) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
987 (eq last-command 'yank) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
988 (eq last-command 'cua-paste)) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
989 (setq cua-paste-pop-count rotate) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
990 (setq last-command 'yank) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
991 (yank-pop cua-paste-pop-count)) |
74454
7d244d3c8089
(cua-paste-pop-rotate-temporarily): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
74365
diff
changeset
|
992 ((and (eq last-command 'cua-paste-pop) (not (consp arg))) |
7d244d3c8089
(cua-paste-pop-rotate-temporarily): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
74365
diff
changeset
|
993 (setq cua-paste-pop-count (+ cua-paste-pop-count rotate)) |
74365
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
994 (setq last-command 'yank) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
995 (yank-pop cua-paste-pop-count)) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
996 (t |
74454
7d244d3c8089
(cua-paste-pop-rotate-temporarily): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
74365
diff
changeset
|
997 (setq cua-paste-pop-count |
7d244d3c8089
(cua-paste-pop-rotate-temporarily): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
74365
diff
changeset
|
998 (if (consp arg) (+ cua-paste-pop-count rotate -1) 1)) |
74365
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
999 (yank (1+ cua-paste-pop-count))))) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1000 ;; Undo rotating the kill-ring, so next C-y will |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1001 ;; yank the original head. |
74454
7d244d3c8089
(cua-paste-pop-rotate-temporarily): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
74365
diff
changeset
|
1002 (setq kill-ring-yank-pointer kill-ring) |
74365
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1003 (setq this-command 'cua-paste-pop)))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1004 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1005 (defun cua-exchange-point-and-mark (arg) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1006 "Exchanges point and mark, but don't activate the mark. |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1007 Activates the mark if a prefix argument is given." |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1008 (interactive "P") |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1009 (if arg |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1010 (setq mark-active t) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1011 (let (mark-active) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1012 (exchange-point-and-mark) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1013 (if cua--rectangle |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1014 (cua--rectangle-corner 0))))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1015 |
45520
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
1016 ;; Typed text that replaced the highlighted region. |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
1017 (defvar cua--repeat-replace-text nil) |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
1018 |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
1019 (defun cua-repeat-replace-region (arg) |
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
1020 "Repeat replacing text of highlighted region with typed text. |
63869
e7c533a3b1b9
(cua-check-pending-input, cua-repeat-replace-region, cua-mode, cua-debug,
Juanma Barranquero <lekktu@gmail.com>
parents:
63388
diff
changeset
|
1021 Searches for the next stretch of text identical to the region last |
e7c533a3b1b9
(cua-check-pending-input, cua-repeat-replace-region, cua-mode, cua-debug,
Juanma Barranquero <lekktu@gmail.com>
parents:
63388
diff
changeset
|
1022 replaced by typing text over it and replaces it with the same stretch |
45597
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1023 of text." |
45520
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
1024 (interactive "P") |
45597
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1025 (when cua--last-deleted-region-pos |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1026 (save-excursion |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1027 (save-restriction |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1028 (set-buffer (car cua--last-deleted-region-pos)) |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1029 (widen) |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1030 ;; Find the text that replaced the region via the undo list. |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1031 (let ((ul buffer-undo-list) |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1032 (elt (cdr cua--last-deleted-region-pos)) |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1033 u s e) |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1034 (when elt |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1035 (while (consp ul) |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1036 (setq u (car ul) ul (cdr ul)) |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1037 (cond |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1038 ((eq u elt) ;; got it |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1039 (setq ul nil)) |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1040 ((and (consp u) (integerp (car u)) (integerp (cdr u))) |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1041 (if (and s (= (cdr u) s)) |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1042 (setq s (car u)) |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1043 (setq s (car u) e (cdr u))))))) |
74365
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1044 (cond ((and s e (<= s e) (= s (mark t))) |
108467
114b70461f96
CUA mode: Fix use of `filter-buffer-substring' (rework previous change).
Juanma Barranquero <lekktu@gmail.com>
parents:
108276
diff
changeset
|
1045 (setq cua--repeat-replace-text (cua--filter-buffer-noprops s e))) |
74365
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1046 ((and (null s) (eq u elt)) ;; nothing inserted |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1047 (setq cua--repeat-replace-text |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1048 "")) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1049 (t |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1050 (message "Cannot locate replacement text")))))) |
45597
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1051 (setq cua--last-deleted-region-pos nil)) |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1052 (if (and cua--last-deleted-region-text |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1053 cua--repeat-replace-text |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1054 (search-forward cua--last-deleted-region-text nil t nil)) |
c85054b077e6
(cua--last-deleted-region-pos)
Kim F. Storm <storm@cua.dk>
parents:
45541
diff
changeset
|
1055 (replace-match cua--repeat-replace-text arg t))) |
45520
f62b4c7276d7
(cua--repeat-replace-text): New variable.
Kim F. Storm <storm@cua.dk>
parents:
45502
diff
changeset
|
1056 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1057 (defun cua-help-for-region (&optional help) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1058 "Show region specific help in echo area." |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1059 (interactive) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
1060 (message |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1061 (concat (if help "C-?:help " "") |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1062 "C-z:undo C-x:cut C-c:copy C-v:paste S-ret:rect"))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1063 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1064 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1065 ;;; Shift activated / extended region |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1066 |
74365
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1067 (defun cua-pop-to-last-change () |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1068 (let ((undo-list buffer-undo-list) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1069 pos elt) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1070 (while (and (not pos) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1071 (consp undo-list)) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1072 (setq elt (car undo-list) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1073 undo-list (cdr undo-list)) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1074 (cond |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1075 ((integerp elt) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1076 (setq pos elt)) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1077 ((not (consp elt))) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1078 ((and (integerp (cdr elt)) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1079 (or (integerp (car elt)) (stringp (car elt)))) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1080 (setq pos (cdr elt))) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1081 ((and (eq (car elt) 'apply) (consp (cdr elt)) (integerp (cadr elt))) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1082 (setq pos (nth 3 elt))))) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1083 (when (and pos |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1084 (/= pos (point)) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1085 (>= pos (point-min)) (<= pos (point-max))) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1086 (goto-char pos) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1087 t))) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1088 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1089 (defun cua-set-mark (&optional arg) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1090 "Set mark at where point is, clear mark, or jump to mark. |
50253 | 1091 |
1092 With no prefix argument, clear mark if already set. Otherwise, set | |
1093 mark, and push old mark position on local mark ring; also push mark on | |
54851 | 1094 global mark ring if last mark was set in another buffer. |
50253 | 1095 |
1096 With argument, jump to mark, and pop a new position for mark off | |
74365
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1097 the local mark ring (this does not affect the global mark ring). |
50253 | 1098 Use \\[pop-global-mark] to jump to a mark off the global mark ring |
74365
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1099 \(see `pop-global-mark'). |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1100 |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1101 If `cua-auto-mark-last-change' is non-nil, this command behaves as if there |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1102 was an implicit mark at the position of the last buffer change. |
50382
9bf67e990ee1
(cua-set-mark): Unconditionally repeat
Kim F. Storm <storm@cua.dk>
parents:
50295
diff
changeset
|
1103 |
9bf67e990ee1
(cua-set-mark): Unconditionally repeat
Kim F. Storm <storm@cua.dk>
parents:
50295
diff
changeset
|
1104 Repeating the command without the prefix jumps to the next position |
74365
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1105 off the local (or global) mark ring. |
50253 | 1106 |
1107 With a double \\[universal-argument] prefix argument, unconditionally set mark." | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1108 (interactive "P") |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1109 (cond |
50253 | 1110 ((and (consp arg) (> (prefix-numeric-value arg) 4)) |
1111 (push-mark-command nil)) | |
45541
00093b6b87d7
(cua-set-mark): Align pop to marko
Kim F. Storm <storm@cua.dk>
parents:
45520
diff
changeset
|
1112 ((eq last-command 'pop-to-mark-command) |
50253 | 1113 (setq this-command 'pop-to-mark-command) |
1114 (pop-to-mark-command)) | |
50382
9bf67e990ee1
(cua-set-mark): Unconditionally repeat
Kim F. Storm <storm@cua.dk>
parents:
50295
diff
changeset
|
1115 ((and (eq last-command 'pop-global-mark) (not arg)) |
50253 | 1116 (setq this-command 'pop-global-mark) |
1117 (pop-global-mark)) | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1118 (arg |
45541
00093b6b87d7
(cua-set-mark): Align pop to marko
Kim F. Storm <storm@cua.dk>
parents:
45520
diff
changeset
|
1119 (setq this-command 'pop-to-mark-command) |
74365
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1120 (or (and cua-auto-mark-last-change |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1121 (cua-pop-to-last-change)) |
c728cbf657c6
(cua-toggle-set-mark): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
72661
diff
changeset
|
1122 (pop-to-mark-command))) |
71905
8e9a2b05bd3d
(cua-delete-selection, cua-toggle-set-mark): New defcustoms.
Kim F. Storm <storm@cua.dk>
parents:
70799
diff
changeset
|
1123 ((and cua-toggle-set-mark mark-active) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1124 (cua--deactivate) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1125 (message "Mark Cleared")) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1126 (t |
45541
00093b6b87d7
(cua-set-mark): Align pop to marko
Kim F. Storm <storm@cua.dk>
parents:
45520
diff
changeset
|
1127 (push-mark-command nil nil) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1128 (setq cua--explicit-region-start t) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1129 (setq cua--last-region-shifted nil) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1130 (if cua-enable-region-auto-help |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1131 (cua-help-for-region t))))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1132 |
55263
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1133 ;;; Scrolling commands which does not signal errors at top/bottom |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1134 ;;; of buffer at first key-press (instead moves to top/bottom |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1135 ;;; of buffer). |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1136 |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1137 (defun cua-scroll-up (&optional arg) |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1138 "Scroll text of current window upward ARG lines; or near full screen if no ARG. |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1139 If window cannot be scrolled further, move cursor to bottom line instead. |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1140 A near full screen is `next-screen-context-lines' less than a full screen. |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1141 Negative ARG means scroll downward. |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1142 If ARG is the atom `-', scroll downward by nearly full screen." |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1143 (interactive "P") |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1144 (cond |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1145 ((eq arg '-) (cua-scroll-down nil)) |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1146 ((< (prefix-numeric-value arg) 0) |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1147 (cua-scroll-down (- (prefix-numeric-value arg)))) |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1148 ((eobp) |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1149 (scroll-up arg)) ; signal error |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1150 (t |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1151 (condition-case nil |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1152 (scroll-up arg) |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1153 (end-of-buffer (goto-char (point-max))))))) |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1154 |
59972
97e808b19272
(cua-max-undo, cua-undo): Remove.
Kim F. Storm <storm@cua.dk>
parents:
58963
diff
changeset
|
1155 (put 'cua-scroll-up 'CUA 'move) |
94869
c8e2322a0865
Put isearch-scroll property on cua-scroll-up and cua-scroll-down.
Juri Linkov <juri@jurta.org>
parents:
94658
diff
changeset
|
1156 (put 'cua-scroll-up 'isearch-scroll t) |
59972
97e808b19272
(cua-max-undo, cua-undo): Remove.
Kim F. Storm <storm@cua.dk>
parents:
58963
diff
changeset
|
1157 |
55263
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1158 (defun cua-scroll-down (&optional arg) |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1159 "Scroll text of current window downward ARG lines; or near full screen if no ARG. |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1160 If window cannot be scrolled further, move cursor to top line instead. |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1161 A near full screen is `next-screen-context-lines' less than a full screen. |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1162 Negative ARG means scroll upward. |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1163 If ARG is the atom `-', scroll upward by nearly full screen." |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1164 (interactive "P") |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1165 (cond |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1166 ((eq arg '-) (cua-scroll-up nil)) |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1167 ((< (prefix-numeric-value arg) 0) |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1168 (cua-scroll-up (- (prefix-numeric-value arg)))) |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1169 ((bobp) |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1170 (scroll-down arg)) ; signal error |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1171 (t |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1172 (condition-case nil |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1173 (scroll-down arg) |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1174 (beginning-of-buffer (goto-char (point-min))))))) |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1175 |
61150
20dc81ce84e7
(cua-scroll-down): Add CUA property.
Kim F. Storm <storm@cua.dk>
parents:
60488
diff
changeset
|
1176 (put 'cua-scroll-down 'CUA 'move) |
94869
c8e2322a0865
Put isearch-scroll property on cua-scroll-up and cua-scroll-down.
Juri Linkov <juri@jurta.org>
parents:
94658
diff
changeset
|
1177 (put 'cua-scroll-down 'isearch-scroll t) |
59972
97e808b19272
(cua-max-undo, cua-undo): Remove.
Kim F. Storm <storm@cua.dk>
parents:
58963
diff
changeset
|
1178 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1179 ;;; Cursor indications |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1180 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1181 (defun cua--update-indications () |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1182 (let* ((cursor |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1183 (cond |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1184 ((and cua--global-mark-active |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1185 cua-global-mark-cursor-color) |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1186 cua-global-mark-cursor-color) |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1187 ((and buffer-read-only |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1188 cua-read-only-cursor-color) |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1189 cua-read-only-cursor-color) |
56839
8425c441196c
(cua-auto-expand-rectangles): Remove
Kim F. Storm <storm@cua.dk>
parents:
56433
diff
changeset
|
1190 ((and cua-overwrite-cursor-color overwrite-mode) |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1191 cua-overwrite-cursor-color) |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1192 (t cua-normal-cursor-color))) |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1193 (color (if (consp cursor) (cdr cursor) cursor)) |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1194 (type (if (consp cursor) (car cursor) cursor))) |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1195 (if (and color |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1196 (stringp color) |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1197 (not (equal color (frame-parameter nil 'cursor-color)))) |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1198 (set-cursor-color color)) |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1199 (if (and type |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1200 (symbolp type) |
104665
dd47ce8e136c
* emulation/viper-init.el (viper-restore-cursor-type):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
100908
diff
changeset
|
1201 (not (eq type (default-value 'cursor-type)))) |
dd47ce8e136c
* emulation/viper-init.el (viper-restore-cursor-type):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
100908
diff
changeset
|
1202 (setq-default cursor-type type)))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1203 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1204 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1205 ;;; Pre-command hook |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1206 |
64311
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1207 (defun cua--pre-command-handler-1 () |
72661
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1208 ;; Cancel prefix key timeout if user enters another key. |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1209 (when cua--prefix-override-timer |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1210 (if (timerp cua--prefix-override-timer) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1211 (cancel-timer cua--prefix-override-timer)) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1212 (setq cua--prefix-override-timer nil)) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1213 |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1214 (cond |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1215 ;; Only symbol commands can have necessary properties |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1216 ((not (symbolp this-command)) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1217 nil) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1218 |
72661
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1219 ;; Handle delete-selection property on non-movement commands |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1220 ((not (eq (get this-command 'CUA) 'move)) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1221 (when (and mark-active (not deactivate-mark)) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1222 (let* ((ds (or (get this-command 'delete-selection) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1223 (get this-command 'pending-delete))) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1224 (nc (cond |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1225 ((not ds) nil) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1226 ((eq ds 'yank) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1227 'cua-paste) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1228 ((eq ds 'kill) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1229 (if cua--rectangle |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1230 'cua-copy-rectangle |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1231 'cua-copy-region)) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1232 ((eq ds 'supersede) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1233 (if cua--rectangle |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1234 'cua-delete-rectangle |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1235 'cua-delete-region)) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1236 (t |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1237 (if cua--rectangle |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1238 'cua-delete-rectangle ;; replace? |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1239 'cua-replace-region))))) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1240 (if nc |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1241 (setq this-original-command this-command |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1242 this-command nc))))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1243 |
72661
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1244 ;; Handle shifted cursor keys and other movement commands. |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1245 ;; If region is not active, region is activated if key is shifted. |
86101
27ff4954e2a0
(cua--pre-command-handler-1):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85074
diff
changeset
|
1246 ;; If region is active, region is cancelled if key is unshifted |
27ff4954e2a0
(cua--pre-command-handler-1):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85074
diff
changeset
|
1247 ;; (and region not started with C-SPC). |
27ff4954e2a0
(cua--pre-command-handler-1):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85074
diff
changeset
|
1248 ;; If rectangle is active, expand rectangle in specified direction and |
27ff4954e2a0
(cua--pre-command-handler-1):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85074
diff
changeset
|
1249 ;; ignore the movement. |
72661
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1250 ((if window-system |
86101
27ff4954e2a0
(cua--pre-command-handler-1):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85074
diff
changeset
|
1251 ;; Shortcut for window-system, assuming that input-decode-map is empty. |
72661
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1252 (memq 'shift (event-modifiers |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1253 (aref (this-single-command-raw-keys) 0))) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1254 (or |
86101
27ff4954e2a0
(cua--pre-command-handler-1):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85074
diff
changeset
|
1255 ;; Check if the final key-sequence was shifted. |
72661
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1256 (memq 'shift (event-modifiers |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1257 (aref (this-single-command-keys) 0))) |
86101
27ff4954e2a0
(cua--pre-command-handler-1):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85074
diff
changeset
|
1258 ;; If not, maybe the raw key-sequence was mapped by input-decode-map |
27ff4954e2a0
(cua--pre-command-handler-1):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85074
diff
changeset
|
1259 ;; to a shifted key (and then mapped down to its unshifted form). |
27ff4954e2a0
(cua--pre-command-handler-1):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85074
diff
changeset
|
1260 (let* ((keys (this-single-command-raw-keys)) |
27ff4954e2a0
(cua--pre-command-handler-1):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85074
diff
changeset
|
1261 (ev (lookup-key input-decode-map keys))) |
27ff4954e2a0
(cua--pre-command-handler-1):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85074
diff
changeset
|
1262 (or (and (vector ev) (memq 'shift (event-modifiers (aref ev 0)))) |
27ff4954e2a0
(cua--pre-command-handler-1):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85074
diff
changeset
|
1263 ;; Or maybe, the raw key-sequence was not an escape sequence |
27ff4954e2a0
(cua--pre-command-handler-1):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85074
diff
changeset
|
1264 ;; and was shifted (and then mapped down to its unshifted form). |
27ff4954e2a0
(cua--pre-command-handler-1):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85074
diff
changeset
|
1265 (memq 'shift (event-modifiers (aref keys 0))))))) |
72661
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1266 (unless mark-active |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1267 (push-mark-command nil t)) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1268 (setq cua--last-region-shifted t) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1269 (setq cua--explicit-region-start nil)) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1270 |
72661
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1271 ;; Set mark if user explicitly said to do so |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1272 ((or cua--explicit-region-start cua--rectangle) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1273 (unless mark-active |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1274 (push-mark-command nil nil))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
1275 |
72661
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1276 ;; Else clear mark after this command. |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1277 (t |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1278 ;; If we set mark-active to nil here, the region highlight will not be |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1279 ;; removed by the direct_output_ commands. |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1280 (setq deactivate-mark t))) |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1281 |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1282 ;; Detect extension of rectangles by mouse or other movement |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1283 (setq cua--buffer-and-point-before-command |
153255cb260a
(cua--pre-command-handler-1): Rewrite.
Kim F. Storm <storm@cua.dk>
parents:
71905
diff
changeset
|
1284 (if cua--rectangle (cons (current-buffer) (point))))) |
64311
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1285 |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1286 (defun cua--pre-command-handler () |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1287 (when cua-mode |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1288 (condition-case nil |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1289 (cua--pre-command-handler-1) |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1290 (error nil)))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1291 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1292 ;;; Post-command hook |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1293 |
64311
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1294 (defun cua--post-command-handler-1 () |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1295 (when cua--global-mark-active |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1296 (cua--global-mark-post-command)) |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1297 (when (fboundp 'cua--rectangle-post-command) |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1298 (cua--rectangle-post-command)) |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1299 (setq cua--buffer-and-point-before-command nil) |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1300 (if (or (not mark-active) deactivate-mark) |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1301 (setq cua--explicit-region-start nil)) |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1302 |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1303 ;; Debugging |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1304 (if cua--debug |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1305 (cond |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1306 (cua--rectangle (cua--rectangle-assert)) |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1307 (mark-active (message "Mark=%d Point=%d Expl=%s" |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1308 (mark t) (point) cua--explicit-region-start)))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1309 |
64311
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1310 ;; Disable transient-mark-mode if rectangle active in current buffer. |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1311 (if (not (window-minibuffer-p (selected-window))) |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1312 (setq transient-mark-mode (and (not cua--rectangle) |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1313 (if cua-highlight-region-shift-only |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1314 (not cua--explicit-region-start) |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1315 t)))) |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1316 (if cua-enable-cursor-indications |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1317 (cua--update-indications)) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1318 |
64311
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1319 (cua--select-keymaps)) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1320 |
64311
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1321 (defun cua--post-command-handler () |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1322 (when cua-mode |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1323 (condition-case nil |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1324 (cua--post-command-handler-1) |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1325 (error nil)))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1326 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1327 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1328 ;;; Keymaps |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1329 |
67405
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
1330 ;; Cached value of actual cua-rectangle-modifier-key |
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
1331 (defvar cua--rectangle-modifier-key 'meta) |
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
1332 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1333 (defun cua--M/H-key (map key fct) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1334 ;; bind H-KEY or M-KEY to FCT in MAP |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1335 (unless (listp key) (setq key (list key))) |
67405
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
1336 (define-key map (vector (cons cua--rectangle-modifier-key key)) fct)) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1337 |
45502
3cea63601c2a
(cua--self-insert-char-p): New function.
Kim F. Storm <storm@cua.dk>
parents:
45278
diff
changeset
|
1338 (defun cua--self-insert-char-p (def) |
3cea63601c2a
(cua--self-insert-char-p): New function.
Kim F. Storm <storm@cua.dk>
parents:
45278
diff
changeset
|
1339 ;; Return DEF if current key sequence is self-inserting in |
3cea63601c2a
(cua--self-insert-char-p): New function.
Kim F. Storm <storm@cua.dk>
parents:
45278
diff
changeset
|
1340 ;; global-map. |
3cea63601c2a
(cua--self-insert-char-p): New function.
Kim F. Storm <storm@cua.dk>
parents:
45278
diff
changeset
|
1341 (if (memq (global-key-binding (this-single-command-keys)) |
3cea63601c2a
(cua--self-insert-char-p): New function.
Kim F. Storm <storm@cua.dk>
parents:
45278
diff
changeset
|
1342 '(self-insert-command self-insert-iso)) |
3cea63601c2a
(cua--self-insert-char-p): New function.
Kim F. Storm <storm@cua.dk>
parents:
45278
diff
changeset
|
1343 def nil)) |
3cea63601c2a
(cua--self-insert-char-p): New function.
Kim F. Storm <storm@cua.dk>
parents:
45278
diff
changeset
|
1344 |
45225
76c3f51638bd
(cua-mode): Misc. changes to use
Kim F. Storm <storm@cua.dk>
parents:
45074
diff
changeset
|
1345 (defvar cua-global-keymap (make-sparse-keymap) |
76c3f51638bd
(cua-mode): Misc. changes to use
Kim F. Storm <storm@cua.dk>
parents:
45074
diff
changeset
|
1346 "Global keymap for cua-mode; users may add to this keymap.") |
76c3f51638bd
(cua-mode): Misc. changes to use
Kim F. Storm <storm@cua.dk>
parents:
45074
diff
changeset
|
1347 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1348 (defvar cua--cua-keys-keymap (make-sparse-keymap)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1349 (defvar cua--prefix-override-keymap (make-sparse-keymap)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1350 (defvar cua--prefix-repeat-keymap (make-sparse-keymap)) |
86102
79412c640bdf
(cua--keymaps-initialized): Rename from `cua--keymaps-initalized'.
Juanma Barranquero <lekktu@gmail.com>
parents:
86101
diff
changeset
|
1351 (defvar cua--global-mark-keymap (make-sparse-keymap)) ; Initialized when cua-gmrk.el is loaded |
79412c640bdf
(cua--keymaps-initialized): Rename from `cua--keymaps-initalized'.
Juanma Barranquero <lekktu@gmail.com>
parents:
86101
diff
changeset
|
1352 (defvar cua--rectangle-keymap (make-sparse-keymap)) ; Initialized when cua-rect.el is loaded |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1353 (defvar cua--region-keymap (make-sparse-keymap)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1354 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1355 (defvar cua--ena-cua-keys-keymap nil) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1356 (defvar cua--ena-prefix-override-keymap nil) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1357 (defvar cua--ena-prefix-repeat-keymap nil) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1358 (defvar cua--ena-region-keymap nil) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1359 (defvar cua--ena-global-mark-keymap nil) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1360 |
45225
76c3f51638bd
(cua-mode): Misc. changes to use
Kim F. Storm <storm@cua.dk>
parents:
45074
diff
changeset
|
1361 (defvar cua--keymap-alist |
76c3f51638bd
(cua-mode): Misc. changes to use
Kim F. Storm <storm@cua.dk>
parents:
45074
diff
changeset
|
1362 `((cua--ena-prefix-override-keymap . ,cua--prefix-override-keymap) |
76c3f51638bd
(cua-mode): Misc. changes to use
Kim F. Storm <storm@cua.dk>
parents:
45074
diff
changeset
|
1363 (cua--ena-prefix-repeat-keymap . ,cua--prefix-repeat-keymap) |
76c3f51638bd
(cua-mode): Misc. changes to use
Kim F. Storm <storm@cua.dk>
parents:
45074
diff
changeset
|
1364 (cua--ena-cua-keys-keymap . ,cua--cua-keys-keymap) |
76c3f51638bd
(cua-mode): Misc. changes to use
Kim F. Storm <storm@cua.dk>
parents:
45074
diff
changeset
|
1365 (cua--ena-global-mark-keymap . ,cua--global-mark-keymap) |
76c3f51638bd
(cua-mode): Misc. changes to use
Kim F. Storm <storm@cua.dk>
parents:
45074
diff
changeset
|
1366 (cua--rectangle . ,cua--rectangle-keymap) |
76c3f51638bd
(cua-mode): Misc. changes to use
Kim F. Storm <storm@cua.dk>
parents:
45074
diff
changeset
|
1367 (cua--ena-region-keymap . ,cua--region-keymap) |
76c3f51638bd
(cua-mode): Misc. changes to use
Kim F. Storm <storm@cua.dk>
parents:
45074
diff
changeset
|
1368 (cua-mode . ,cua-global-keymap))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1369 |
45225
76c3f51638bd
(cua-mode): Misc. changes to use
Kim F. Storm <storm@cua.dk>
parents:
45074
diff
changeset
|
1370 (defun cua--select-keymaps () |
76c3f51638bd
(cua-mode): Misc. changes to use
Kim F. Storm <storm@cua.dk>
parents:
45074
diff
changeset
|
1371 ;; Setup conditions for selecting the proper keymaps in cua--keymap-alist. |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1372 (setq cua--ena-region-keymap |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1373 (and mark-active (not deactivate-mark))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1374 (setq cua--ena-prefix-override-keymap |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1375 (and cua--ena-region-keymap |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1376 cua-enable-cua-keys |
45074
d57f600f5b7e
(cua-inhibit-cua-keys): New buffer-local variable.
Kim F. Storm <storm@cua.dk>
parents:
45062
diff
changeset
|
1377 (not cua-inhibit-cua-keys) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1378 (or (eq cua-enable-cua-keys t) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1379 (not cua--explicit-region-start)) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1380 (not executing-kbd-macro) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1381 (not cua--prefix-override-timer))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1382 (setq cua--ena-prefix-repeat-keymap |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1383 (and cua--ena-region-keymap |
67385
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1384 (or (timerp cua--prefix-override-timer) |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1385 (eq cua--prefix-override-timer 'shift)))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1386 (setq cua--ena-cua-keys-keymap |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1387 (and cua-enable-cua-keys |
45074
d57f600f5b7e
(cua-inhibit-cua-keys): New buffer-local variable.
Kim F. Storm <storm@cua.dk>
parents:
45062
diff
changeset
|
1388 (not cua-inhibit-cua-keys) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1389 (or (eq cua-enable-cua-keys t) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1390 cua--last-region-shifted))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1391 (setq cua--ena-global-mark-keymap |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1392 (and cua--global-mark-active |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1393 (not (window-minibuffer-p))))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1394 |
86102
79412c640bdf
(cua--keymaps-initialized): Rename from `cua--keymaps-initalized'.
Juanma Barranquero <lekktu@gmail.com>
parents:
86101
diff
changeset
|
1395 (defvar cua--keymaps-initialized nil) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1396 |
67385
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1397 (defun cua--shift-control-prefix (prefix arg) |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1398 ;; handle S-C-x and S-C-c by emulating the fast double prefix function. |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1399 ;; Don't record this command |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1400 (setq this-command last-command) |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1401 ;; Restore the prefix arg |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1402 (setq prefix-arg arg) |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1403 (reset-this-command-lengths) |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1404 ;; Activate the cua--prefix-repeat-keymap |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1405 (setq cua--prefix-override-timer 'shift) |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1406 ;; Push duplicate keys back on the event queue |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1407 (setq unread-command-events (cons prefix (cons prefix unread-command-events)))) |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1408 |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1409 (defun cua--shift-control-c-prefix (arg) |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1410 (interactive "P") |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1411 (cua--shift-control-prefix ?\C-c arg)) |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1412 |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1413 (defun cua--shift-control-x-prefix (arg) |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1414 (interactive "P") |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1415 (cua--shift-control-prefix ?\C-x arg)) |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1416 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1417 (defun cua--init-keymaps () |
67405
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
1418 ;; Cache actual rectangle modifier key. |
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
1419 (setq cua--rectangle-modifier-key |
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
1420 (if (and cua-rectangle-modifier-key |
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
1421 (memq window-system '(x))) |
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
1422 cua-rectangle-modifier-key |
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
1423 'meta)) |
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
1424 ;; C-return always toggles rectangle mark |
69668
16f8a4a89f79
(cua-rectangle-mark-key): New defcustom.
Kim F. Storm <storm@cua.dk>
parents:
68648
diff
changeset
|
1425 (define-key cua-global-keymap cua-rectangle-mark-key 'cua-set-rectangle-mark) |
67405
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
1426 (unless (eq cua--rectangle-modifier-key 'meta) |
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
1427 (cua--M/H-key cua-global-keymap ?\s 'cua-set-rectangle-mark) |
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
1428 (define-key cua-global-keymap |
f8d3bd39d0a1
* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
Kim F. Storm <storm@cua.dk>
parents:
67385
diff
changeset
|
1429 (vector (list cua--rectangle-modifier-key 'mouse-1)) 'cua-mouse-set-rectangle-mark)) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1430 |
64558
19736ad15819
(cua-mode, cua-enable-register-prefix, cua-enable-cua-keys, cua-use-hyper-key,
Juanma Barranquero <lekktu@gmail.com>
parents:
64527
diff
changeset
|
1431 (define-key cua-global-keymap [(shift control ?\s)] 'cua-toggle-global-mark) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1432 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1433 ;; replace region with rectangle or element on kill ring |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1434 (define-key cua-global-keymap [remap yank] 'cua-paste) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1435 (define-key cua-global-keymap [remap clipboard-yank] 'cua-paste) |
76132
0d644f70ff05
(cua-paste): Handle x-clipboard-yank.
Kim F. Storm <storm@cua.dk>
parents:
75488
diff
changeset
|
1436 (define-key cua-global-keymap [remap x-clipboard-yank] 'cua-paste) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1437 ;; replace current yank with previous kill ring element |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1438 (define-key cua-global-keymap [remap yank-pop] 'cua-paste-pop) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1439 ;; set mark |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1440 (define-key cua-global-keymap [remap set-mark-command] 'cua-set-mark) |
112227
07e52ed69b5d
* emulation/cua-base.el (cua--init-keymaps):
Kim F. Storm <storm@cua.dk>
parents:
111091
diff
changeset
|
1441 (define-key cua-global-keymap [remap exchange-point-and-mark] 'cua-exchange-point-and-mark) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1442 |
55263
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1443 ;; scrolling |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1444 (define-key cua-global-keymap [remap scroll-up] 'cua-scroll-up) |
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1445 (define-key cua-global-keymap [remap scroll-down] 'cua-scroll-down) |
107784
45b05d993766
Scrolling commands which does not signal errors at top/bottom.
Juri Linkov <juri@jurta.org>
parents:
106815
diff
changeset
|
1446 (define-key cua-global-keymap [remap scroll-up-command] 'cua-scroll-up) |
45b05d993766
Scrolling commands which does not signal errors at top/bottom.
Juri Linkov <juri@jurta.org>
parents:
106815
diff
changeset
|
1447 (define-key cua-global-keymap [remap scroll-down-command] 'cua-scroll-down) |
55263
eb737a4709cb
(cua--standard-movement-commands):
Kim F. Storm <storm@cua.dk>
parents:
54851
diff
changeset
|
1448 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1449 (define-key cua--cua-keys-keymap [(control x) timeout] 'kill-region) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1450 (define-key cua--cua-keys-keymap [(control c) timeout] 'copy-region-as-kill) |
92353 | 1451 (when cua-remap-control-z |
1452 (define-key cua--cua-keys-keymap [(control z)] 'undo)) | |
1453 (when cua-remap-control-v | |
1454 (define-key cua--cua-keys-keymap [(control v)] 'yank) | |
1455 (define-key cua--cua-keys-keymap [(meta v)] 'cua-repeat-replace-region)) | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1456 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1457 (define-key cua--prefix-override-keymap [(control x)] 'cua--prefix-override-handler) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1458 (define-key cua--prefix-override-keymap [(control c)] 'cua--prefix-override-handler) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
1459 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1460 (define-key cua--prefix-repeat-keymap [(control x) (control x)] 'cua--prefix-repeat-handler) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1461 (define-key cua--prefix-repeat-keymap [(control c) (control c)] 'cua--prefix-repeat-handler) |
92353 | 1462 (dolist (key '(up down left right home end next prior)) |
1463 (define-key cua--prefix-repeat-keymap (vector '(control x) key) 'cua--prefix-cut-handler) | |
1464 (define-key cua--prefix-repeat-keymap (vector '(control c) key) 'cua--prefix-copy-handler)) | |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1465 |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49430
diff
changeset
|
1466 ;; Enable shifted fallbacks for C-x and C-c when region is active |
67385
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1467 (define-key cua--region-keymap [(shift control x)] 'cua--shift-control-x-prefix) |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1468 (define-key cua--region-keymap [(shift control c)] 'cua--shift-control-c-prefix) |
15ed3778b098
(cua--select-keymaps): Enable repeat
Kim F. Storm <storm@cua.dk>
parents:
65896
diff
changeset
|
1469 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1470 ;; replace current region |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1471 (define-key cua--region-keymap [remap self-insert-command] 'cua-replace-region) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1472 (define-key cua--region-keymap [remap self-insert-iso] 'cua-replace-region) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1473 (define-key cua--region-keymap [remap insert-register] 'cua-replace-region) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1474 (define-key cua--region-keymap [remap newline-and-indent] 'cua-replace-region) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1475 (define-key cua--region-keymap [remap newline] 'cua-replace-region) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1476 (define-key cua--region-keymap [remap open-line] 'cua-replace-region) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1477 ;; delete current region |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1478 (define-key cua--region-keymap [remap delete-backward-char] 'cua-delete-region) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1479 (define-key cua--region-keymap [remap backward-delete-char] 'cua-delete-region) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1480 (define-key cua--region-keymap [remap backward-delete-char-untabify] 'cua-delete-region) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1481 (define-key cua--region-keymap [remap delete-char] 'cua-delete-region) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1482 ;; kill region |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1483 (define-key cua--region-keymap [remap kill-region] 'cua-cut-region) |
62184
d2e6a54e6fb1
(cua-copy-region, cua-cut-region)
Kim F. Storm <storm@cua.dk>
parents:
62023
diff
changeset
|
1484 (define-key cua--region-keymap [remap clipboard-kill-region] 'cua-cut-region) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1485 ;; copy region |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1486 (define-key cua--region-keymap [remap copy-region-as-kill] 'cua-copy-region) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1487 (define-key cua--region-keymap [remap kill-ring-save] 'cua-copy-region) |
62184
d2e6a54e6fb1
(cua-copy-region, cua-cut-region)
Kim F. Storm <storm@cua.dk>
parents:
62023
diff
changeset
|
1488 (define-key cua--region-keymap [remap clipboard-kill-ring-save] 'cua-copy-region) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1489 ;; cancel current region/rectangle |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1490 (define-key cua--region-keymap [remap keyboard-escape-quit] 'cua-cancel) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1491 (define-key cua--region-keymap [remap keyboard-quit] 'cua-cancel) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1492 ) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1493 |
59972
97e808b19272
(cua-max-undo, cua-undo): Remove.
Kim F. Storm <storm@cua.dk>
parents:
58963
diff
changeset
|
1494 |
97e808b19272
(cua-max-undo, cua-undo): Remove.
Kim F. Storm <storm@cua.dk>
parents:
58963
diff
changeset
|
1495 ;; Setup standard movement commands to be recognized by CUA. |
97e808b19272
(cua-max-undo, cua-undo): Remove.
Kim F. Storm <storm@cua.dk>
parents:
58963
diff
changeset
|
1496 |
97e808b19272
(cua-max-undo, cua-undo): Remove.
Kim F. Storm <storm@cua.dk>
parents:
58963
diff
changeset
|
1497 (dolist (cmd |
97e808b19272
(cua-max-undo, cua-undo): Remove.
Kim F. Storm <storm@cua.dk>
parents:
58963
diff
changeset
|
1498 '(forward-char backward-char |
108830
0d7ed8742a5f
emulation/cua-base.el: Recognize `right-char', `left-char' as movement commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
108467
diff
changeset
|
1499 right-char left-char |
108832
d901ae131f55
emulation/cua-base.el: Recognize also `right-word' and `left-word'.
Juanma Barranquero <lekktu@gmail.com>
parents:
108830
diff
changeset
|
1500 right-word left-word |
59972
97e808b19272
(cua-max-undo, cua-undo): Remove.
Kim F. Storm <storm@cua.dk>
parents:
58963
diff
changeset
|
1501 next-line previous-line |
97e808b19272
(cua-max-undo, cua-undo): Remove.
Kim F. Storm <storm@cua.dk>
parents:
58963
diff
changeset
|
1502 forward-word backward-word |
97e808b19272
(cua-max-undo, cua-undo): Remove.
Kim F. Storm <storm@cua.dk>
parents:
58963
diff
changeset
|
1503 end-of-line beginning-of-line |
100490
c5d38073ec91
(cmd): Add beginning-of-visual-line and
Martin Rudalics <rudalics@gmx.at>
parents:
96376
diff
changeset
|
1504 end-of-visual-line beginning-of-visual-line |
60488
234a7cab00e4
Put CUA move property on move-end-of-line
Kim F. Storm <storm@cua.dk>
parents:
59996
diff
changeset
|
1505 move-end-of-line move-beginning-of-line |
59972
97e808b19272
(cua-max-undo, cua-undo): Remove.
Kim F. Storm <storm@cua.dk>
parents:
58963
diff
changeset
|
1506 end-of-buffer beginning-of-buffer |
97e808b19272
(cua-max-undo, cua-undo): Remove.
Kim F. Storm <storm@cua.dk>
parents:
58963
diff
changeset
|
1507 scroll-up scroll-down |
107784
45b05d993766
Scrolling commands which does not signal errors at top/bottom.
Juri Linkov <juri@jurta.org>
parents:
106815
diff
changeset
|
1508 scroll-up-command scroll-down-command |
65726
01f4ad04e6ac
Set CUA move property on additional commands:
Kim F. Storm <storm@cua.dk>
parents:
64989
diff
changeset
|
1509 up-list down-list backward-up-list |
01f4ad04e6ac
Set CUA move property on additional commands:
Kim F. Storm <storm@cua.dk>
parents:
64989
diff
changeset
|
1510 end-of-defun beginning-of-defun |
01f4ad04e6ac
Set CUA move property on additional commands:
Kim F. Storm <storm@cua.dk>
parents:
64989
diff
changeset
|
1511 forward-sexp backward-sexp |
01f4ad04e6ac
Set CUA move property on additional commands:
Kim F. Storm <storm@cua.dk>
parents:
64989
diff
changeset
|
1512 forward-list backward-list |
59972
97e808b19272
(cua-max-undo, cua-undo): Remove.
Kim F. Storm <storm@cua.dk>
parents:
58963
diff
changeset
|
1513 forward-sentence backward-sentence |
105921
b3189a049bbf
* emulation/cua-base.el: Add CUA property to some CC mode commands
Chong Yidong <cyd@stupidchicken.com>
parents:
105372
diff
changeset
|
1514 forward-paragraph backward-paragraph |
b3189a049bbf
* emulation/cua-base.el: Add CUA property to some CC mode commands
Chong Yidong <cyd@stupidchicken.com>
parents:
105372
diff
changeset
|
1515 ;; CC mode motion commands |
b3189a049bbf
* emulation/cua-base.el: Add CUA property to some CC mode commands
Chong Yidong <cyd@stupidchicken.com>
parents:
105372
diff
changeset
|
1516 c-forward-conditional c-backward-conditional |
b3189a049bbf
* emulation/cua-base.el: Add CUA property to some CC mode commands
Chong Yidong <cyd@stupidchicken.com>
parents:
105372
diff
changeset
|
1517 c-down-conditional c-up-conditional |
b3189a049bbf
* emulation/cua-base.el: Add CUA property to some CC mode commands
Chong Yidong <cyd@stupidchicken.com>
parents:
105372
diff
changeset
|
1518 c-down-conditional-with-else c-up-conditional-with-else |
b3189a049bbf
* emulation/cua-base.el: Add CUA property to some CC mode commands
Chong Yidong <cyd@stupidchicken.com>
parents:
105372
diff
changeset
|
1519 c-beginning-of-statement c-end-of-statement)) |
59972
97e808b19272
(cua-max-undo, cua-undo): Remove.
Kim F. Storm <storm@cua.dk>
parents:
58963
diff
changeset
|
1520 (put cmd 'CUA 'move)) |
97e808b19272
(cua-max-undo, cua-undo): Remove.
Kim F. Storm <storm@cua.dk>
parents:
58963
diff
changeset
|
1521 |
45278
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1522 ;; State prior to enabling cua-mode |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1523 ;; Value is a list with the following elements: |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1524 ;; transient-mark-mode |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1525 ;; delete-selection-mode |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1526 ;; pc-selection-mode |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1527 |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1528 (defvar cua--saved-state nil) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1529 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1530 ;;;###autoload |
50636
0af2d4122c02
(cua-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50382
diff
changeset
|
1531 (define-minor-mode cua-mode |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1532 "Toggle CUA key-binding mode. |
64527
95c2d98fdeb1
(cua-mode): Improve doc string.
Kim F. Storm <storm@cua.dk>
parents:
64311
diff
changeset
|
1533 When enabled, using shifted movement keys will activate the |
95c2d98fdeb1
(cua-mode): Improve doc string.
Kim F. Storm <storm@cua.dk>
parents:
64311
diff
changeset
|
1534 region (and highlight the region using `transient-mark-mode'), |
95c2d98fdeb1
(cua-mode): Improve doc string.
Kim F. Storm <storm@cua.dk>
parents:
64311
diff
changeset
|
1535 and typed text replaces the active selection. |
95c2d98fdeb1
(cua-mode): Improve doc string.
Kim F. Storm <storm@cua.dk>
parents:
64311
diff
changeset
|
1536 |
95c2d98fdeb1
(cua-mode): Improve doc string.
Kim F. Storm <storm@cua.dk>
parents:
64311
diff
changeset
|
1537 Also when enabled, you can use C-z, C-x, C-c, and C-v to undo, |
95c2d98fdeb1
(cua-mode): Improve doc string.
Kim F. Storm <storm@cua.dk>
parents:
64311
diff
changeset
|
1538 cut, copy, and paste in addition to the normal Emacs bindings. |
95c2d98fdeb1
(cua-mode): Improve doc string.
Kim F. Storm <storm@cua.dk>
parents:
64311
diff
changeset
|
1539 The C-x and C-c keys only do cut and copy when the region is |
95c2d98fdeb1
(cua-mode): Improve doc string.
Kim F. Storm <storm@cua.dk>
parents:
64311
diff
changeset
|
1540 active, so in most cases, they do not conflict with the normal |
95c2d98fdeb1
(cua-mode): Improve doc string.
Kim F. Storm <storm@cua.dk>
parents:
64311
diff
changeset
|
1541 function of these prefix keys. |
95c2d98fdeb1
(cua-mode): Improve doc string.
Kim F. Storm <storm@cua.dk>
parents:
64311
diff
changeset
|
1542 |
95c2d98fdeb1
(cua-mode): Improve doc string.
Kim F. Storm <storm@cua.dk>
parents:
64311
diff
changeset
|
1543 If you really need to perform a command which starts with one of |
95c2d98fdeb1
(cua-mode): Improve doc string.
Kim F. Storm <storm@cua.dk>
parents:
64311
diff
changeset
|
1544 the prefix keys even when the region is active, you have three |
95c2d98fdeb1
(cua-mode): Improve doc string.
Kim F. Storm <storm@cua.dk>
parents:
64311
diff
changeset
|
1545 options: |
95c2d98fdeb1
(cua-mode): Improve doc string.
Kim F. Storm <storm@cua.dk>
parents:
64311
diff
changeset
|
1546 - press the prefix key twice very quickly (within 0.2 seconds), |
64558
19736ad15819
(cua-mode, cua-enable-register-prefix, cua-enable-cua-keys, cua-use-hyper-key,
Juanma Barranquero <lekktu@gmail.com>
parents:
64527
diff
changeset
|
1547 - press the prefix key and the following key within 0.2 seconds, or |
64527
95c2d98fdeb1
(cua-mode): Improve doc string.
Kim F. Storm <storm@cua.dk>
parents:
64311
diff
changeset
|
1548 - use the SHIFT key with the prefix key, i.e. C-S-x or C-S-c. |
95c2d98fdeb1
(cua-mode): Improve doc string.
Kim F. Storm <storm@cua.dk>
parents:
64311
diff
changeset
|
1549 |
95c2d98fdeb1
(cua-mode): Improve doc string.
Kim F. Storm <storm@cua.dk>
parents:
64311
diff
changeset
|
1550 You can customize `cua-enable-cua-keys' to completely disable the |
95c2d98fdeb1
(cua-mode): Improve doc string.
Kim F. Storm <storm@cua.dk>
parents:
64311
diff
changeset
|
1551 CUA bindings, or `cua-prefix-override-inhibit-delay' to change |
68523
bbaecffc7697
(cua-mode): Mention that CUA enables
Kim F. Storm <storm@cua.dk>
parents:
67405
diff
changeset
|
1552 the prefix fallback behavior. |
bbaecffc7697
(cua-mode): Mention that CUA enables
Kim F. Storm <storm@cua.dk>
parents:
67405
diff
changeset
|
1553 |
68570 | 1554 CUA mode manages Transient Mark mode internally. Trying to disable |
1555 Transient Mark mode while CUA mode is enabled does not work; if you | |
68523
bbaecffc7697
(cua-mode): Mention that CUA enables
Kim F. Storm <storm@cua.dk>
parents:
67405
diff
changeset
|
1556 only want to highlight the region when it is selected using a |
bbaecffc7697
(cua-mode): Mention that CUA enables
Kim F. Storm <storm@cua.dk>
parents:
67405
diff
changeset
|
1557 shifted movement key, set `cua-highlight-region-shift-only'." |
50636
0af2d4122c02
(cua-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50382
diff
changeset
|
1558 :global t |
61279 | 1559 :group 'cua |
69668
16f8a4a89f79
(cua-rectangle-mark-key): New defcustom.
Kim F. Storm <storm@cua.dk>
parents:
68648
diff
changeset
|
1560 :set-after '(cua-enable-modeline-indications |
92353 | 1561 cua-remap-control-v cua-remap-control-z |
69668
16f8a4a89f79
(cua-rectangle-mark-key): New defcustom.
Kim F. Storm <storm@cua.dk>
parents:
68648
diff
changeset
|
1562 cua-rectangle-mark-key cua-rectangle-modifier-key) |
50636
0af2d4122c02
(cua-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50382
diff
changeset
|
1563 :require 'cua-base |
0af2d4122c02
(cua-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50382
diff
changeset
|
1564 :link '(emacs-commentary-link "cua-base.el") |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1565 (setq mark-even-if-inactive t) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1566 (setq highlight-nonselected-windows nil) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1567 |
86102
79412c640bdf
(cua--keymaps-initialized): Rename from `cua--keymaps-initalized'.
Juanma Barranquero <lekktu@gmail.com>
parents:
86101
diff
changeset
|
1568 (unless cua--keymaps-initialized |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1569 (cua--init-keymaps) |
86102
79412c640bdf
(cua--keymaps-initialized): Rename from `cua--keymaps-initalized'.
Juanma Barranquero <lekktu@gmail.com>
parents:
86101
diff
changeset
|
1570 (setq cua--keymaps-initialized t)) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1571 |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1572 (if cua-mode |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1573 (progn |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1574 (add-hook 'pre-command-hook 'cua--pre-command-handler) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1575 (add-hook 'post-command-hook 'cua--post-command-handler) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1576 (if (and cua-enable-modeline-indications (not (assoc 'cua-mode minor-mode-alist))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1577 (setq minor-mode-alist (cons '(cua-mode cua--status-string) minor-mode-alist))) |
55267
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1578 (if cua-enable-cursor-indications |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1579 (cua--update-indications))) |
4a6854d33d2b
* emulation/cua-base.el: Add support for changing cursor types;
Kim F. Storm <storm@cua.dk>
parents:
55263
diff
changeset
|
1580 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1581 (remove-hook 'pre-command-hook 'cua--pre-command-handler) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1582 (remove-hook 'post-command-hook 'cua--post-command-handler)) |
45225
76c3f51638bd
(cua-mode): Misc. changes to use
Kim F. Storm <storm@cua.dk>
parents:
45074
diff
changeset
|
1583 |
76c3f51638bd
(cua-mode): Misc. changes to use
Kim F. Storm <storm@cua.dk>
parents:
45074
diff
changeset
|
1584 (if (not cua-mode) |
76c3f51638bd
(cua-mode): Misc. changes to use
Kim F. Storm <storm@cua.dk>
parents:
45074
diff
changeset
|
1585 (setq emulation-mode-map-alists (delq 'cua--keymap-alist emulation-mode-map-alists)) |
63388
cabaef9d110d
(cua-mode): Use add-to-ordered-list to
Kim F. Storm <storm@cua.dk>
parents:
63180
diff
changeset
|
1586 (add-to-ordered-list 'emulation-mode-map-alists 'cua--keymap-alist 400) |
45225
76c3f51638bd
(cua-mode): Misc. changes to use
Kim F. Storm <storm@cua.dk>
parents:
45074
diff
changeset
|
1587 (cua--select-keymaps)) |
76c3f51638bd
(cua-mode): Misc. changes to use
Kim F. Storm <storm@cua.dk>
parents:
45074
diff
changeset
|
1588 |
45278
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1589 (cond |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1590 (cua-mode |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1591 (setq cua--saved-state |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1592 (list |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1593 transient-mark-mode |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1594 (and (boundp 'delete-selection-mode) delete-selection-mode) |
93551
e2159923235d
(cua-mode): Turn off shift-select-mode.
Chong Yidong <cyd@stupidchicken.com>
parents:
93053
diff
changeset
|
1595 (and (boundp 'pc-selection-mode) pc-selection-mode) |
e2159923235d
(cua-mode): Turn off shift-select-mode.
Chong Yidong <cyd@stupidchicken.com>
parents:
93053
diff
changeset
|
1596 shift-select-mode)) |
45278
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1597 (if (and (boundp 'delete-selection-mode) delete-selection-mode) |
51587
d7e174e9d6eb
(cua-mode): Use explicit arg to turn off minor modes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50636
diff
changeset
|
1598 (delete-selection-mode -1)) |
45278
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1599 (if (and (boundp 'pc-selection-mode) pc-selection-mode) |
51587
d7e174e9d6eb
(cua-mode): Use explicit arg to turn off minor modes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50636
diff
changeset
|
1600 (pc-selection-mode -1)) |
55341
7ee62cfb248c
(cua-mode): Deactivate mark when cua-mode is enabled.
Kim F. Storm <storm@cua.dk>
parents:
55336
diff
changeset
|
1601 (cua--deactivate) |
93551
e2159923235d
(cua-mode): Turn off shift-select-mode.
Chong Yidong <cyd@stupidchicken.com>
parents:
93053
diff
changeset
|
1602 (setq shift-select-mode nil) |
45278
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1603 (setq transient-mark-mode (and cua-mode |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1604 (if cua-highlight-region-shift-only |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1605 (not cua--explicit-region-start) |
50636
0af2d4122c02
(cua-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50382
diff
changeset
|
1606 t)))) |
45278
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1607 (cua--saved-state |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1608 (setq transient-mark-mode (car cua--saved-state)) |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1609 (if (nth 1 cua--saved-state) |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1610 (delete-selection-mode 1)) |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1611 (if (nth 2 cua--saved-state) |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1612 (pc-selection-mode 1)) |
93551
e2159923235d
(cua-mode): Turn off shift-select-mode.
Chong Yidong <cyd@stupidchicken.com>
parents:
93053
diff
changeset
|
1613 (setq shift-select-mode (nth 3 cua--saved-state)) |
105372
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
104665
diff
changeset
|
1614 (if (called-interactively-p 'interactive) |
45278
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1615 (message "CUA mode disabled.%s%s%s%s" |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1616 (if (nth 1 cua--saved-state) " Delete-Selection" "") |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1617 (if (and (nth 1 cua--saved-state) (nth 2 cua--saved-state)) " and" "") |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1618 (if (nth 2 cua--saved-state) " PC-Selection" "") |
97b1e590eb61
(cua-enable-cursor-indications): Default off.
Kim F. Storm <storm@cua.dk>
parents:
45231
diff
changeset
|
1619 (if (or (nth 1 cua--saved-state) (nth 2 cua--saved-state)) " enabled" ""))) |
50636
0af2d4122c02
(cua-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50382
diff
changeset
|
1620 (setq cua--saved-state nil)))) |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1621 |
64311
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1622 |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1623 ;;;###autoload |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1624 (defun cua-selection-mode (arg) |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1625 "Enable CUA selection mode without the C-z/C-x/C-c/C-v bindings." |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1626 (interactive "P") |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1627 (setq-default cua-enable-cua-keys nil) |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1628 (cua-mode arg)) |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1629 |
d1bb70278f2a
(cua--pre-command-handler-1, cua--pre-command-handler)
Kim F. Storm <storm@cua.dk>
parents:
64085
diff
changeset
|
1630 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1631 (defun cua-debug () |
63869
e7c533a3b1b9
(cua-check-pending-input, cua-repeat-replace-region, cua-mode, cua-debug,
Juanma Barranquero <lekktu@gmail.com>
parents:
63388
diff
changeset
|
1632 "Toggle CUA debugging." |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1633 (interactive) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1634 (setq cua--debug (not cua--debug))) |
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1635 |
49898
53baa12e5cee
Add run-time check to catch users trying
Kim F. Storm <storm@cua.dk>
parents:
49598
diff
changeset
|
1636 |
87021
f4056febc5ff
(top-level): Move (provide 'cua-base) to end.
Glenn Morris <rgm@gnu.org>
parents:
86346
diff
changeset
|
1637 (provide 'cua-base) |
50060 | 1638 |
44938
358d42530d42
Added cua-mode based files [split from original cua.el]:
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1639 ;;; cua-base.el ends here |