Mercurial > emacs
comparison lisp/emulation/cua-base.el @ 90182:f042e7c0fe20
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-53
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 302-319)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 69)
- Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 20 May 2005 04:22:05 +0000 |
parents | 62afea0771d8 be9a675832ec |
children | 173dee4e2611 |
comparison
equal
deleted
inserted
replaced
90181:0c828e2b0b6f | 90182:f042e7c0fe20 |
---|---|
1 ;;; cua-base.el --- emulate CUA key bindings | 1 ;;; cua-base.el --- emulate CUA key bindings |
2 | 2 |
3 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 | 3 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2005 |
4 ;; Free Software Foundation, Inc. | 4 ;; Free Software Foundation, Inc. |
5 | 5 |
6 ;; Author: Kim F. Storm <storm@cua.dk> | 6 ;; Author: Kim F. Storm <storm@cua.dk> |
7 ;; Keywords: keyboard emulation convenience cua | 7 ;; Keywords: keyboard emulation convenience cua |
8 | 8 |
157 ;; short line, you can still extend the rectangle to include more columns | 157 ;; short line, you can still extend the rectangle to include more columns |
158 ;; of longer lines in the same rectangle. And you can also have the | 158 ;; of longer lines in the same rectangle. And you can also have the |
159 ;; left edge of a rectangle start in the middle of a TAB character. | 159 ;; left edge of a rectangle start in the middle of a TAB character. |
160 ;; Sounds strange? Try it! | 160 ;; Sounds strange? Try it! |
161 ;; | 161 ;; |
162 ;; To start a rectangle, use [S-return] and extend it using the normal | 162 ;; To start a rectangle, use [C-return] and extend it using the normal |
163 ;; movement keys (up, down, left, right, home, end, C-home, | 163 ;; movement keys (up, down, left, right, home, end, C-home, |
164 ;; C-end). Once the rectangle has the desired size, you can cut or | 164 ;; C-end). Once the rectangle has the desired size, you can cut or |
165 ;; copy it using C-x and C-c (or C-w and M-w), and you can | 165 ;; copy it using C-x and C-c (or C-w and M-w), and you can |
166 ;; subsequently insert it - as a rectangle - using C-v (or C-y). So | 166 ;; subsequently insert it - as a rectangle - using C-v (or C-y). So |
167 ;; the only new command you need to know to work with cua-mode | 167 ;; the only new command you need to know to work with cua-mode |
168 ;; rectangles is S-return! | 168 ;; rectangles is C-return! |
169 ;; | 169 ;; |
170 ;; Normally, when you paste a rectangle using C-v (C-y), each line of | 170 ;; Normally, when you paste a rectangle using C-v (C-y), each line of |
171 ;; the rectangle is inserted into the existing lines in the buffer. | 171 ;; the rectangle is inserted into the existing lines in the buffer. |
172 ;; If overwrite-mode is active when you paste a rectangle, it is | 172 ;; If overwrite-mode is active when you paste a rectangle, it is |
173 ;; inserted as normal (multi-line) text. | 173 ;; inserted as normal (multi-line) text. |
181 ;; [return] to move the cursor to the "next" corner. Or you can use | 181 ;; [return] to move the cursor to the "next" corner. Or you can use |
182 ;; the [M-up], [M-down], [M-left], and [M-right] keys to move the | 182 ;; the [M-up], [M-down], [M-left], and [M-right] keys to move the |
183 ;; entire rectangle overlay (but not the contents) in the given | 183 ;; entire rectangle overlay (but not the contents) in the given |
184 ;; direction. | 184 ;; direction. |
185 ;; | 185 ;; |
186 ;; [S-return] cancels the rectangle | 186 ;; [C-return] cancels the rectangle |
187 ;; [C-space] activates the region bounded by the rectangle | 187 ;; [C-space] activates the region bounded by the rectangle |
188 | 188 |
189 ;; If you type a normal (self-inserting) character when the rectangle is | 189 ;; If you type a normal (self-inserting) character when the rectangle is |
190 ;; active, the character is inserted on the "current side" of every line | 190 ;; active, the character is inserted on the "current side" of every line |
191 ;; of the rectangle. The "current side" is the side on which the cursor | 191 ;; of the rectangle. The "current side" is the side on which the cursor |
192 ;; is currently located. If the rectangle is only 1 column wide, | 192 ;; is currently located. If the rectangle is only 1 column wide, |
193 ;; insertion will be performed to the left when the cursor is at the | 193 ;; insertion will be performed to the left when the cursor is at the |
194 ;; bottom of the rectangle. So, for example, to comment out an entire | 194 ;; bottom of the rectangle. So, for example, to comment out an entire |
195 ;; paragraph like this one, just place the cursor on the first character | 195 ;; paragraph like this one, just place the cursor on the first character |
196 ;; of the first line, and enter the following: | 196 ;; of the first line, and enter the following: |
197 ;; S-return M-} ; ; <space> S-return | 197 ;; C-return M-} ; ; <space> C-return |
198 | 198 |
199 ;; cua-mode's rectangle support also includes all the normal rectangle | 199 ;; cua-mode's rectangle support also includes all the normal rectangle |
200 ;; functions with easy access: | 200 ;; functions with easy access: |
201 ;; | 201 ;; |
202 ;; [M-a] aligns all words at the left edge of the rectangle | 202 ;; [M-a] aligns all words at the left edge of the rectangle |
328 "*If non-nil, save last deleted region or rectangle to register 0." | 328 "*If non-nil, save last deleted region or rectangle to register 0." |
329 :type 'boolean | 329 :type 'boolean |
330 :group 'cua) | 330 :group 'cua) |
331 | 331 |
332 (defcustom cua-use-hyper-key nil | 332 (defcustom cua-use-hyper-key nil |
333 "*If non-nil, bind rectangle commands to H-? instead of M-?. | 333 "*If non-nil, bind rectangle commands to H-... instead of M-.... |
334 If set to 'also, toggle region command is also on S-return. | 334 If set to 'also, toggle region command is also on C-return. |
335 Must be set prior to enabling CUA." | 335 Must be set prior to enabling CUA." |
336 :type '(choice (const :tag "Meta key and S-return" nil) | 336 :type '(choice (const :tag "Meta key and C-return" nil) |
337 (const :tag "Hyper key only" only) | 337 (const :tag "Hyper key only" only) |
338 (const :tag "Hyper key and S-return" also)) | 338 (const :tag "Hyper key and C-return" also)) |
339 :group 'cua) | 339 :group 'cua) |
340 | 340 |
341 (defcustom cua-enable-region-auto-help nil | 341 (defcustom cua-enable-region-auto-help nil |
342 "*If non-nil, automatically show help for active region." | 342 "*If non-nil, automatically show help for active region." |
343 :type 'boolean | 343 :type 'boolean |
1233 | 1233 |
1234 (defvar cua--keymaps-initalized nil) | 1234 (defvar cua--keymaps-initalized nil) |
1235 | 1235 |
1236 (defun cua--init-keymaps () | 1236 (defun cua--init-keymaps () |
1237 (unless (eq cua-use-hyper-key 'only) | 1237 (unless (eq cua-use-hyper-key 'only) |
1238 (define-key cua-global-keymap [(shift return)] 'cua-set-rectangle-mark)) | 1238 (define-key cua-global-keymap [(control return)] 'cua-set-rectangle-mark)) |
1239 (when cua-use-hyper-key | 1239 (when cua-use-hyper-key |
1240 (cua--M/H-key cua-global-keymap 'space 'cua-set-rectangle-mark) | 1240 (cua--M/H-key cua-global-keymap 'space 'cua-set-rectangle-mark) |
1241 (define-key cua-global-keymap [(hyper mouse-1)] 'cua-mouse-set-rectangle-mark)) | 1241 (define-key cua-global-keymap [(hyper mouse-1)] 'cua-mouse-set-rectangle-mark)) |
1242 | 1242 |
1243 (define-key cua-global-keymap [(shift control ? )] 'cua-toggle-global-mark) | 1243 (define-key cua-global-keymap [(shift control ? )] 'cua-toggle-global-mark) |