aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emulation
diff options
context:
space:
mode:
authorStefan Monnier2003-04-18 22:49:41 +0000
committerStefan Monnier2003-04-18 22:49:41 +0000
commit80d9508acf9bfa8035b0b51c2001f0ea79e33e7d (patch)
tree833b55d7103a4193fc4002ea9c1624a316665f87 /lisp/emulation
parenteb81f2758fe168ce4c38b59ea7aadd1e481ceb19 (diff)
downloademacs-80d9508acf9bfa8035b0b51c2001f0ea79e33e7d.tar.gz
emacs-80d9508acf9bfa8035b0b51c2001f0ea79e33e7d.zip
(cua-mode): Use define-minor-mode.
(cua-global-mark-face): Fix face format.
Diffstat (limited to 'lisp/emulation')
-rw-r--r--lisp/emulation/cua-base.el53
1 files changed, 11 insertions, 42 deletions
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index 34f79e9cb28..2215e46a0ce 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -260,29 +260,6 @@
260 :link '(emacs-commentary-link :tag "Commentary" "cua-base.el") 260 :link '(emacs-commentary-link :tag "Commentary" "cua-base.el")
261 :link '(emacs-library-link :tag "Lisp File" "cua-base.el")) 261 :link '(emacs-library-link :tag "Lisp File" "cua-base.el"))
262 262
263;;;###autoload
264(defcustom cua-mode nil
265 "Non-nil means that CUA emulation mode is enabled.
266In CUA mode, shifted movement keys highlight and extend the region.
267When a region is highlighted, the binding of the C-x and C-c keys are
268temporarily changed to work as Motif, MAC or MS-Windows cut and paste.
269Also, insertion commands first delete the region and then insert.
270This mode enables Transient Mark mode and it provides a superset of the
271PC Selection Mode and Delete Selection Modes.
272
273Setting this variable directly does not take effect;
274use either \\[customize] or the function `cua-mode'."
275 :set (lambda (symbol value)
276 (cua-mode (or value 0)))
277 :initialize 'custom-initialize-default
278 :set-after '(cua-enable-modeline-indications cua-use-hyper-key)
279 :require 'cua-base
280 :link '(emacs-commentary-link "cua-base.el")
281 :version "21.4"
282 :type 'boolean
283 :group 'cua)
284
285
286(defcustom cua-enable-cua-keys t 263(defcustom cua-enable-cua-keys t
287 "*Enable using C-z, C-x, C-c, and C-v for undo, cut, copy, and paste. 264 "*Enable using C-z, C-x, C-c, and C-v for undo, cut, copy, and paste.
288If the value is t, these mappings are always enabled. If the value is 265If the value is t, these mappings are always enabled. If the value is
@@ -405,9 +382,9 @@ Can be toggled by [M-p] while the rectangle is active,"
405 :group 'cua) 382 :group 'cua)
406 383
407(defface cua-global-mark-face '((((class color)) 384(defface cua-global-mark-face '((((class color))
408 (:foreground "black") 385 :foreground "black"
409 (:background "yellow")) 386 :background "yellow")
410 (t (:bold t))) 387 (t :bold t))
411 "*Font used by CUA for highlighting the global mark." 388 "*Font used by CUA for highlighting the global mark."
412 :group 'cua) 389 :group 'cua)
413 390
@@ -1181,19 +1158,17 @@ Extra commands should be added to `cua-movement-commands'")
1181(defvar cua--saved-state nil) 1158(defvar cua--saved-state nil)
1182 1159
1183;;;###autoload 1160;;;###autoload
1184(defun cua-mode (&optional arg) 1161(define-minor-mode cua-mode
1185 "Toggle CUA key-binding mode. 1162 "Toggle CUA key-binding mode.
1186When enabled, using shifted movement keys will activate the region (and 1163When enabled, using shifted movement keys will activate the region (and
1187highlight the region using `transient-mark-mode'), and typed text replaces 1164highlight the region using `transient-mark-mode'), and typed text replaces
1188the active selection. C-z, C-x, C-c, and C-v will undo, cut, copy, and 1165the active selection. C-z, C-x, C-c, and C-v will undo, cut, copy, and
1189paste (in addition to the normal emacs bindings)." 1166paste (in addition to the normal emacs bindings)."
1190 (interactive "P") 1167 :global t
1191 (setq cua-mode 1168 :set-after '(cua-enable-modeline-indications cua-use-hyper-key)
1192 (cond 1169 :require 'cua-base
1193 ((null arg) (not cua-mode)) 1170 :link '(emacs-commentary-link "cua-base.el")
1194 ((symbolp arg) t) 1171 :version "21.4"
1195 (t (> (prefix-numeric-value arg) 0))))
1196
1197 (setq mark-even-if-inactive t) 1172 (setq mark-even-if-inactive t)
1198 (setq highlight-nonselected-windows nil) 1173 (setq highlight-nonselected-windows nil)
1199 (make-variable-buffer-local 'cua--explicit-region-start) 1174 (make-variable-buffer-local 'cua--explicit-region-start)
@@ -1235,9 +1210,7 @@ paste (in addition to the normal emacs bindings)."
1235 (setq transient-mark-mode (and cua-mode 1210 (setq transient-mark-mode (and cua-mode
1236 (if cua-highlight-region-shift-only 1211 (if cua-highlight-region-shift-only
1237 (not cua--explicit-region-start) 1212 (not cua--explicit-region-start)
1238 t))) 1213 t))))
1239 (if (interactive-p)
1240 (message "CUA mode enabled")))
1241 (cua--saved-state 1214 (cua--saved-state
1242 (setq transient-mark-mode (car cua--saved-state)) 1215 (setq transient-mark-mode (car cua--saved-state))
1243 (if (nth 1 cua--saved-state) 1216 (if (nth 1 cua--saved-state)
@@ -1250,11 +1223,7 @@ paste (in addition to the normal emacs bindings)."
1250 (if (and (nth 1 cua--saved-state) (nth 2 cua--saved-state)) " and" "") 1223 (if (and (nth 1 cua--saved-state) (nth 2 cua--saved-state)) " and" "")
1251 (if (nth 2 cua--saved-state) " PC-Selection" "") 1224 (if (nth 2 cua--saved-state) " PC-Selection" "")
1252 (if (or (nth 1 cua--saved-state) (nth 2 cua--saved-state)) " enabled" ""))) 1225 (if (or (nth 1 cua--saved-state) (nth 2 cua--saved-state)) " enabled" "")))
1253 (setq cua--saved-state nil)) 1226 (setq cua--saved-state nil))))
1254
1255 (t
1256 (if (interactive-p)
1257 (message "CUA mode disabled")))))
1258 1227
1259(defun cua-debug () 1228(defun cua-debug ()
1260 "Toggle cua debugging." 1229 "Toggle cua debugging."