Mercurial > emacs
comparison lisp/emulation/cua-base.el @ 83408:39bb10ce301a
Merged in changes from CVS trunk.
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-667
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-669
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-670
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-157
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-158
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-159
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-160
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-161
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-162
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-163
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-164
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-165
Update from CVS: texi/message.texi: Fix default values.
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-166
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-167
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-168
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-448
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Sun, 11 Dec 2005 22:42:40 +0000 |
parents | 7d093d9d4479 f8d3bd39d0a1 |
children | 49f9dd4bb117 |
comparison
equal
deleted
inserted
replaced
83407:37d0562504bf | 83408:39bb10ce301a |
---|---|
327 (defcustom cua-delete-copy-to-register-0 t | 327 (defcustom cua-delete-copy-to-register-0 t |
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 | |
333 "*If non-nil, bind rectangle commands to H-... instead of M-.... | |
334 If set to `also', toggle region command is also on C-return. | |
335 Must be set prior to enabling CUA." | |
336 :type '(choice (const :tag "Meta key and C-return" nil) | |
337 (const :tag "Hyper key only" only) | |
338 (const :tag "Hyper key and C-return" also)) | |
339 :group 'cua) | |
340 | |
341 (defcustom cua-enable-region-auto-help nil | 332 (defcustom cua-enable-region-auto-help nil |
342 "*If non-nil, automatically show help for active region." | 333 "*If non-nil, automatically show help for active region." |
343 :type 'boolean | 334 :type 'boolean |
344 :group 'cua) | 335 :group 'cua) |
345 | 336 |
375 present. The number specifies then number of characters before | 366 present. The number specifies then number of characters before |
376 and after the region marked by the rectangle to search." | 367 and after the region marked by the rectangle to search." |
377 :type '(choice (number :tag "Auto detect (limit)") | 368 :type '(choice (number :tag "Auto detect (limit)") |
378 (const :tag "Disabled" nil) | 369 (const :tag "Disabled" nil) |
379 (other :tag "Enabled" t)) | 370 (other :tag "Enabled" t)) |
371 :group 'cua) | |
372 | |
373 (defcustom cua-rectangle-modifier-key 'meta | |
374 "*Modifier key used for rectangle commands bindings. | |
375 On non-window systems, always use the meta modifier. | |
376 Must be set prior to enabling CUA." | |
377 :type '(choice (const :tag "Meta key" meta) | |
378 (const :tag "Hyper key" hyper ) | |
379 (const :tag "Super key" super)) | |
380 :group 'cua) | 380 :group 'cua) |
381 | 381 |
382 (defcustom cua-enable-rectangle-auto-help t | 382 (defcustom cua-enable-rectangle-auto-help t |
383 "*If non-nil, automatically show help for region, rectangle and global mark." | 383 "*If non-nil, automatically show help for region, rectangle and global mark." |
384 :type 'boolean | 384 :type 'boolean |
1178 (error nil)))) | 1178 (error nil)))) |
1179 | 1179 |
1180 | 1180 |
1181 ;;; Keymaps | 1181 ;;; Keymaps |
1182 | 1182 |
1183 ;; Cached value of actual cua-rectangle-modifier-key | |
1184 (defvar cua--rectangle-modifier-key 'meta) | |
1185 | |
1183 (defun cua--M/H-key (map key fct) | 1186 (defun cua--M/H-key (map key fct) |
1184 ;; bind H-KEY or M-KEY to FCT in MAP | 1187 ;; bind H-KEY or M-KEY to FCT in MAP |
1185 (if (eq key 'space) (setq key ?\s)) | |
1186 (unless (listp key) (setq key (list key))) | 1188 (unless (listp key) (setq key (list key))) |
1187 (define-key map (vector (cons (if cua-use-hyper-key 'hyper 'meta) key)) fct)) | 1189 (define-key map (vector (cons cua--rectangle-modifier-key key)) fct)) |
1188 | 1190 |
1189 (defun cua--self-insert-char-p (def) | 1191 (defun cua--self-insert-char-p (def) |
1190 ;; Return DEF if current key sequence is self-inserting in | 1192 ;; Return DEF if current key sequence is self-inserting in |
1191 ;; global-map. | 1193 ;; global-map. |
1192 (if (memq (global-key-binding (this-single-command-keys)) | 1194 (if (memq (global-key-binding (this-single-command-keys)) |
1230 (not cua--explicit-region-start)) | 1232 (not cua--explicit-region-start)) |
1231 (not executing-kbd-macro) | 1233 (not executing-kbd-macro) |
1232 (not cua--prefix-override-timer))) | 1234 (not cua--prefix-override-timer))) |
1233 (setq cua--ena-prefix-repeat-keymap | 1235 (setq cua--ena-prefix-repeat-keymap |
1234 (and cua--ena-region-keymap | 1236 (and cua--ena-region-keymap |
1235 (timerp cua--prefix-override-timer))) | 1237 (or (timerp cua--prefix-override-timer) |
1238 (eq cua--prefix-override-timer 'shift)))) | |
1236 (setq cua--ena-cua-keys-keymap | 1239 (setq cua--ena-cua-keys-keymap |
1237 (and cua-enable-cua-keys | 1240 (and cua-enable-cua-keys |
1238 (not cua-inhibit-cua-keys) | 1241 (not cua-inhibit-cua-keys) |
1239 (or (eq cua-enable-cua-keys t) | 1242 (or (eq cua-enable-cua-keys t) |
1240 cua--last-region-shifted))) | 1243 cua--last-region-shifted))) |
1242 (and cua--global-mark-active | 1245 (and cua--global-mark-active |
1243 (not (window-minibuffer-p))))) | 1246 (not (window-minibuffer-p))))) |
1244 | 1247 |
1245 (defvar cua--keymaps-initalized nil) | 1248 (defvar cua--keymaps-initalized nil) |
1246 | 1249 |
1250 (defun cua--shift-control-prefix (prefix arg) | |
1251 ;; handle S-C-x and S-C-c by emulating the fast double prefix function. | |
1252 ;; Don't record this command | |
1253 (setq this-command last-command) | |
1254 ;; Restore the prefix arg | |
1255 (setq prefix-arg arg) | |
1256 (reset-this-command-lengths) | |
1257 ;; Activate the cua--prefix-repeat-keymap | |
1258 (setq cua--prefix-override-timer 'shift) | |
1259 ;; Push duplicate keys back on the event queue | |
1260 (setq unread-command-events (cons prefix (cons prefix unread-command-events)))) | |
1261 | |
1262 (defun cua--shift-control-c-prefix (arg) | |
1263 (interactive "P") | |
1264 (cua--shift-control-prefix ?\C-c arg)) | |
1265 | |
1266 (defun cua--shift-control-x-prefix (arg) | |
1267 (interactive "P") | |
1268 (cua--shift-control-prefix ?\C-x arg)) | |
1269 | |
1247 (defun cua--init-keymaps () | 1270 (defun cua--init-keymaps () |
1248 (unless (eq cua-use-hyper-key 'only) | 1271 ;; Cache actual rectangle modifier key. |
1249 (define-key cua-global-keymap [(control return)] 'cua-set-rectangle-mark)) | 1272 (setq cua--rectangle-modifier-key |
1250 (when cua-use-hyper-key | 1273 (if (and cua-rectangle-modifier-key |
1251 (cua--M/H-key cua-global-keymap 'space 'cua-set-rectangle-mark) | 1274 (memq window-system '(x))) |
1252 (define-key cua-global-keymap [(hyper mouse-1)] 'cua-mouse-set-rectangle-mark)) | 1275 cua-rectangle-modifier-key |
1276 'meta)) | |
1277 ;; C-return always toggles rectangle mark | |
1278 (define-key cua-global-keymap [(control return)] 'cua-set-rectangle-mark) | |
1279 (unless (eq cua--rectangle-modifier-key 'meta) | |
1280 (cua--M/H-key cua-global-keymap ?\s 'cua-set-rectangle-mark) | |
1281 (define-key cua-global-keymap | |
1282 (vector (list cua--rectangle-modifier-key 'mouse-1)) 'cua-mouse-set-rectangle-mark)) | |
1253 | 1283 |
1254 (define-key cua-global-keymap [(shift control ?\s)] 'cua-toggle-global-mark) | 1284 (define-key cua-global-keymap [(shift control ?\s)] 'cua-toggle-global-mark) |
1255 | 1285 |
1256 ;; replace region with rectangle or element on kill ring | 1286 ;; replace region with rectangle or element on kill ring |
1257 (define-key cua-global-keymap [remap yank] 'cua-paste) | 1287 (define-key cua-global-keymap [remap yank] 'cua-paste) |
1285 (define-key cua--prefix-repeat-keymap [(control c) down] 'cua--prefix-copy-handler) | 1315 (define-key cua--prefix-repeat-keymap [(control c) down] 'cua--prefix-copy-handler) |
1286 (define-key cua--prefix-repeat-keymap [(control c) left] 'cua--prefix-copy-handler) | 1316 (define-key cua--prefix-repeat-keymap [(control c) left] 'cua--prefix-copy-handler) |
1287 (define-key cua--prefix-repeat-keymap [(control c) right] 'cua--prefix-copy-handler) | 1317 (define-key cua--prefix-repeat-keymap [(control c) right] 'cua--prefix-copy-handler) |
1288 | 1318 |
1289 ;; Enable shifted fallbacks for C-x and C-c when region is active | 1319 ;; Enable shifted fallbacks for C-x and C-c when region is active |
1290 (define-key cua--region-keymap [(shift control x)] 'Control-X-prefix) | 1320 (define-key cua--region-keymap [(shift control x)] 'cua--shift-control-x-prefix) |
1291 (define-key cua--region-keymap [(shift control c)] 'mode-specific-command-prefix) | 1321 (define-key cua--region-keymap [(shift control c)] 'cua--shift-control-c-prefix) |
1322 | |
1292 ;; replace current region | 1323 ;; replace current region |
1293 (define-key cua--region-keymap [remap self-insert-command] 'cua-replace-region) | 1324 (define-key cua--region-keymap [remap self-insert-command] 'cua-replace-region) |
1294 (define-key cua--region-keymap [remap self-insert-iso] 'cua-replace-region) | 1325 (define-key cua--region-keymap [remap self-insert-iso] 'cua-replace-region) |
1295 (define-key cua--region-keymap [remap insert-register] 'cua-replace-region) | 1326 (define-key cua--region-keymap [remap insert-register] 'cua-replace-region) |
1296 (define-key cua--region-keymap [remap newline-and-indent] 'cua-replace-region) | 1327 (define-key cua--region-keymap [remap newline-and-indent] 'cua-replace-region) |
1363 You can customize `cua-enable-cua-keys' to completely disable the | 1394 You can customize `cua-enable-cua-keys' to completely disable the |
1364 CUA bindings, or `cua-prefix-override-inhibit-delay' to change | 1395 CUA bindings, or `cua-prefix-override-inhibit-delay' to change |
1365 the prefix fallback behavior." | 1396 the prefix fallback behavior." |
1366 :global t | 1397 :global t |
1367 :group 'cua | 1398 :group 'cua |
1368 :set-after '(cua-enable-modeline-indications cua-use-hyper-key) | 1399 :set-after '(cua-enable-modeline-indications cua-rectangle-modifier-key) |
1369 :require 'cua-base | 1400 :require 'cua-base |
1370 :link '(emacs-commentary-link "cua-base.el") | 1401 :link '(emacs-commentary-link "cua-base.el") |
1371 (setq mark-even-if-inactive t) | 1402 (setq mark-even-if-inactive t) |
1372 (setq highlight-nonselected-windows nil) | 1403 (setq highlight-nonselected-windows nil) |
1373 | 1404 |