diff options
| author | Stefan Monnier | 2003-04-18 22:49:41 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2003-04-18 22:49:41 +0000 |
| commit | 80d9508acf9bfa8035b0b51c2001f0ea79e33e7d (patch) | |
| tree | 833b55d7103a4193fc4002ea9c1624a316665f87 /lisp | |
| parent | eb81f2758fe168ce4c38b59ea7aadd1e481ceb19 (diff) | |
| download | emacs-80d9508acf9bfa8035b0b51c2001f0ea79e33e7d.tar.gz emacs-80d9508acf9bfa8035b0b51c2001f0ea79e33e7d.zip | |
(cua-mode): Use define-minor-mode.
(cua-global-mark-face): Fix face format.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/emulation/cua-base.el | 53 |
2 files changed, 18 insertions, 42 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8068bc2669c..75449735bab 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,12 @@ | |||
| 1 | 2003-04-18 Stefan Monnier <monnier@cs.yale.edu> | 1 | 2003-04-18 Stefan Monnier <monnier@cs.yale.edu> |
| 2 | 2 | ||
| 3 | * emulation/cua-base.el (cua-mode): Use define-minor-mode. | ||
| 4 | (cua-global-mark-face): Fix face format. | ||
| 5 | |||
| 6 | * emacs-lisp/easy-mmode.el (define-minor-mode): Only echo a message | ||
| 7 | if the body didn't do so already. | ||
| 8 | (easy-mmode-define-keymap): Remove unused var `suppress'. | ||
| 9 | |||
| 3 | * view.el (view-read-only): Move to files.el. | 10 | * view.el (view-read-only): Move to files.el. |
| 4 | * files.el (view-read-only): Move from view.el. | 11 | * files.el (view-read-only): Move from view.el. |
| 5 | 12 | ||
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. | ||
| 266 | In CUA mode, shifted movement keys highlight and extend the region. | ||
| 267 | When a region is highlighted, the binding of the C-x and C-c keys are | ||
| 268 | temporarily changed to work as Motif, MAC or MS-Windows cut and paste. | ||
| 269 | Also, insertion commands first delete the region and then insert. | ||
| 270 | This mode enables Transient Mark mode and it provides a superset of the | ||
| 271 | PC Selection Mode and Delete Selection Modes. | ||
| 272 | |||
| 273 | Setting this variable directly does not take effect; | ||
| 274 | use 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. |
| 288 | If the value is t, these mappings are always enabled. If the value is | 265 | If 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. |
| 1186 | When enabled, using shifted movement keys will activate the region (and | 1163 | When enabled, using shifted movement keys will activate the region (and |
| 1187 | highlight the region using `transient-mark-mode'), and typed text replaces | 1164 | highlight the region using `transient-mark-mode'), and typed text replaces |
| 1188 | the active selection. C-z, C-x, C-c, and C-v will undo, cut, copy, and | 1165 | the active selection. C-z, C-x, C-c, and C-v will undo, cut, copy, and |
| 1189 | paste (in addition to the normal emacs bindings)." | 1166 | paste (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." |