388 |
|
|
389 |
;;; Cursor Indication Customization |
;;; Cursor Indication Customization |
390 |
|
|
391 |
(defcustom cua-enable-cursor-indications t |
(defcustom cua-enable-cursor-indications nil |
392 |
"*If non-nil, use different cursor colors for indications." |
"*If non-nil, use different cursor colors for indications." |
393 |
:type 'boolean |
:type 'boolean |
394 |
:group 'cua) |
:group 'cua) |
1069 |
(define-key cua--region-keymap [remap keyboard-quit] 'cua-cancel) |
(define-key cua--region-keymap [remap keyboard-quit] 'cua-cancel) |
1070 |
) |
) |
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) |
1079 |
|
|
1080 |
;;;###autoload |
;;;###autoload |
1081 |
(defun cua-mode (&optional arg) |
(defun cua-mode (&optional arg) |
1117 |
|
|
1118 |
(if (fboundp 'cua--rectangle-on-off) |
(if (fboundp 'cua--rectangle-on-off) |
1119 |
(cua--rectangle-on-off cua-mode)) |
(cua--rectangle-on-off cua-mode)) |
1120 |
(setq transient-mark-mode (and cua-mode |
|
1121 |
(if cua-highlight-region-shift-only |
(cond |
1122 |
(not cua--explicit-region-start) |
(cua-mode |
1123 |
t)))) |
(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"))))) |
1155 |
|
|
1156 |
(defun cua-debug () |
(defun cua-debug () |
1157 |
"Toggle cua debugging." |
"Toggle cua debugging." |