Mercurial > emacs
comparison lisp/emulation/cua-base.el @ 45278:97b1e590eb61
(cua-enable-cursor-indications): Default off.
(cua-mode): Print Enabled/Disabled messages if interactive.
Disable delete-selection-mode and pc-selection-mode when cua-mode
is enabled; reenable if cua-mode is turned off.
Remember setting of transient-mark-mode when cua-mode is enabled;
restore if cua-mode is disabled.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Mon, 13 May 2002 20:35:30 +0000 |
parents | d68e3a5fce0c |
children | 3cea63601c2a |
comparison
equal
deleted
inserted
replaced
45277:597192e844f8 | 45278:97b1e590eb61 |
---|---|
386 :group 'cua) | 386 :group 'cua) |
387 | 387 |
388 | 388 |
389 ;;; Cursor Indication Customization | 389 ;;; Cursor Indication Customization |
390 | 390 |
391 (defcustom cua-enable-cursor-indications t | 391 (defcustom cua-enable-cursor-indications nil |
392 "*If non-nil, use different cursor colors for indications." | 392 "*If non-nil, use different cursor colors for indications." |
393 :type 'boolean | 393 :type 'boolean |
394 :group 'cua) | 394 :group 'cua) |
395 | 395 |
396 (defcustom cua-normal-cursor-color nil | 396 (defcustom cua-normal-cursor-color nil |
1067 ;; cancel current region/rectangle | 1067 ;; cancel current region/rectangle |
1068 (define-key cua--region-keymap [remap keyboard-escape-quit] 'cua-cancel) | 1068 (define-key cua--region-keymap [remap keyboard-escape-quit] 'cua-cancel) |
1069 (define-key cua--region-keymap [remap keyboard-quit] 'cua-cancel) | 1069 (define-key cua--region-keymap [remap keyboard-quit] 'cua-cancel) |
1070 ) | 1070 ) |
1071 | 1071 |
1072 ;; State prior to enabling cua-mode | |
1073 ;; Value is a list with the following elements: | |
1074 ;; transient-mark-mode | |
1075 ;; delete-selection-mode | |
1076 ;; pc-selection-mode | |
1077 | |
1078 (defvar cua--saved-state nil) | |
1072 | 1079 |
1073 ;;;###autoload | 1080 ;;;###autoload |
1074 (defun cua-mode (&optional arg) | 1081 (defun cua-mode (&optional arg) |
1075 "Toggle CUA key-binding mode. | 1082 "Toggle CUA key-binding mode. |
1076 When enabled, using shifted movement keys will activate the region (and | 1083 When enabled, using shifted movement keys will activate the region (and |
1108 (add-to-list 'emulation-mode-map-alists 'cua--keymap-alist) | 1115 (add-to-list 'emulation-mode-map-alists 'cua--keymap-alist) |
1109 (cua--select-keymaps)) | 1116 (cua--select-keymaps)) |
1110 | 1117 |
1111 (if (fboundp 'cua--rectangle-on-off) | 1118 (if (fboundp 'cua--rectangle-on-off) |
1112 (cua--rectangle-on-off cua-mode)) | 1119 (cua--rectangle-on-off cua-mode)) |
1113 (setq transient-mark-mode (and cua-mode | 1120 |
1114 (if cua-highlight-region-shift-only | 1121 (cond |
1115 (not cua--explicit-region-start) | 1122 (cua-mode |
1116 t)))) | 1123 (setq cua--saved-state |
1124 (list | |
1125 transient-mark-mode | |
1126 (and (boundp 'delete-selection-mode) delete-selection-mode) | |
1127 (and (boundp 'pc-selection-mode) pc-selection-mode))) | |
1128 (if (and (boundp 'delete-selection-mode) delete-selection-mode) | |
1129 (delete-selection-mode)) | |
1130 (if (and (boundp 'pc-selection-mode) pc-selection-mode) | |
1131 (pc-selection-mode)) | |
1132 (setq transient-mark-mode (and cua-mode | |
1133 (if cua-highlight-region-shift-only | |
1134 (not cua--explicit-region-start) | |
1135 t))) | |
1136 (if (interactive-p) | |
1137 (message "CUA mode enabled"))) | |
1138 (cua--saved-state | |
1139 (setq transient-mark-mode (car cua--saved-state)) | |
1140 (if (nth 1 cua--saved-state) | |
1141 (delete-selection-mode 1)) | |
1142 (if (nth 2 cua--saved-state) | |
1143 (pc-selection-mode 1)) | |
1144 (if (interactive-p) | |
1145 (message "CUA mode disabled.%s%s%s%s" | |
1146 (if (nth 1 cua--saved-state) " Delete-Selection" "") | |
1147 (if (and (nth 1 cua--saved-state) (nth 2 cua--saved-state)) " and" "") | |
1148 (if (nth 2 cua--saved-state) " PC-Selection" "") | |
1149 (if (or (nth 1 cua--saved-state) (nth 2 cua--saved-state)) " enabled" ""))) | |
1150 (setq cua--saved-state nil)) | |
1151 | |
1152 (t | |
1153 (if (interactive-p) | |
1154 (message "CUA mode disabled"))))) | |
1117 | 1155 |
1118 (defun cua-debug () | 1156 (defun cua-debug () |
1119 "Toggle cua debugging." | 1157 "Toggle cua debugging." |
1120 (interactive) | 1158 (interactive) |
1121 (setq cua--debug (not cua--debug))) | 1159 (setq cua--debug (not cua--debug))) |