diff options
| author | Stefan Monnier | 2005-02-21 13:43:53 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2005-02-21 13:43:53 +0000 |
| commit | 485464c434b07d774276131fcb59da80b9cb350b (patch) | |
| tree | 5e4b37422a5f4d37586a0ff1d42bc7c6777fc10f | |
| parent | 478a161d790a32883d123693fd23ff706e6b4cb0 (diff) | |
| download | emacs-485464c434b07d774276131fcb59da80b9cb350b.tar.gz emacs-485464c434b07d774276131fcb59da80b9cb350b.zip | |
(blink-cursor-mode): Use define-minor-mode.
| -rw-r--r-- | lisp/frame.el | 80 |
1 files changed, 28 insertions, 52 deletions
diff --git a/lisp/frame.el b/lisp/frame.el index 2aff4860cf3..5da549fd73e 100644 --- a/lisp/frame.el +++ b/lisp/frame.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; frame.el --- multi-frame management independent of window systems | 1 | ;;; frame.el --- multi-frame management independent of window systems |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1993, 1994, 1996, 1997, 2000, 2001, 2003, 2004 | 3 | ;; Copyright (C) 1993, 1994, 1996, 1997, 2000, 2001, 2003, 2004, 2005 |
| 4 | ;; Free Software Foundation, Inc. | 4 | ;; Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Maintainer: FSF | 6 | ;; Maintainer: FSF |
| @@ -1256,35 +1256,11 @@ The function `blink-cursor-start' is called when the timer fires.") | |||
| 1256 | This timer calls `blink-cursor-timer-function' every | 1256 | This timer calls `blink-cursor-timer-function' every |
| 1257 | `blink-cursor-interval' seconds.") | 1257 | `blink-cursor-interval' seconds.") |
| 1258 | 1258 | ||
| 1259 | ;; The strange sequence below is meant to set both the right temporary | 1259 | ;; We do not know the standard _evaluated_ value yet, because the standard |
| 1260 | ;; value and the right "standard expression" , according to Custom, | 1260 | ;; expression uses values that are not yet set. The correct evaluated |
| 1261 | ;; for blink-cursor-mode. We do not know the standard _evaluated_ | 1261 | ;; standard value will be installed in startup.el using exactly the same |
| 1262 | ;; value yet, because the standard expression uses values that are not | 1262 | ;; expression as in the defcustom. |
| 1263 | ;; yet set. Evaluating it now would yield an error, but we make sure | 1263 | (define-minor-mode blink-cursor-mode |
| 1264 | ;; that it is not evaluated, by ensuring that blink-cursor-mode is set | ||
| 1265 | ;; before the defcustom is evaluated and by using the right :initialize | ||
| 1266 | ;; function. The correct evaluated standard value will be installed | ||
| 1267 | ;; in startup.el using exactly the same expression as in the defcustom. | ||
| 1268 | (defvar blink-cursor-mode) | ||
| 1269 | (unless (boundp 'blink-cursor-mode) (setq blink-cursor-mode nil)) | ||
| 1270 | (defcustom blink-cursor-mode | ||
| 1271 | (not (or noninteractive | ||
| 1272 | emacs-quick-startup | ||
| 1273 | (eq system-type 'ms-dos) | ||
| 1274 | (not (memq window-system '(x w32))))) | ||
| 1275 | "*Non-nil means Blinking Cursor mode is active." | ||
| 1276 | :group 'cursor | ||
| 1277 | :tag "Blinking cursor" | ||
| 1278 | :type 'boolean | ||
| 1279 | :initialize 'custom-initialize-set | ||
| 1280 | :set #'(lambda (symbol value) | ||
| 1281 | (set-default symbol value) | ||
| 1282 | (blink-cursor-mode (or value 0)))) | ||
| 1283 | |||
| 1284 | (defvaralias 'blink-cursor 'blink-cursor-mode) | ||
| 1285 | (make-obsolete-variable 'blink-cursor 'blink-cursor-mode "22.1") | ||
| 1286 | |||
| 1287 | (defun blink-cursor-mode (arg) | ||
| 1288 | "Toggle blinking cursor mode. | 1264 | "Toggle blinking cursor mode. |
| 1289 | With a numeric argument, turn blinking cursor mode on iff ARG is positive. | 1265 | With a numeric argument, turn blinking cursor mode on iff ARG is positive. |
| 1290 | When blinking cursor mode is enabled, the cursor of the selected | 1266 | When blinking cursor mode is enabled, the cursor of the selected |
| @@ -1293,27 +1269,27 @@ window blinks. | |||
| 1293 | Note that this command is effective only when Emacs | 1269 | Note that this command is effective only when Emacs |
| 1294 | displays through a window system, because then Emacs does its own | 1270 | displays through a window system, because then Emacs does its own |
| 1295 | cursor display. On a text-only terminal, this is not implemented." | 1271 | cursor display. On a text-only terminal, this is not implemented." |
| 1296 | (interactive "P") | 1272 | :init-value (not (or noninteractive |
| 1297 | (let ((on-p (if (null arg) | 1273 | emacs-quick-startup |
| 1298 | (not blink-cursor-mode) | 1274 | (eq system-type 'ms-dos) |
| 1299 | (> (prefix-numeric-value arg) 0)))) | 1275 | (not (memq window-system '(x w32))))) |
| 1300 | (if blink-cursor-idle-timer | 1276 | :global t |
| 1301 | (cancel-timer blink-cursor-idle-timer)) | 1277 | (if blink-cursor-idle-timer (cancel-timer blink-cursor-idle-timer)) |
| 1302 | (if blink-cursor-timer | 1278 | (if blink-cursor-timer (cancel-timer blink-cursor-timer)) |
| 1303 | (cancel-timer blink-cursor-timer)) | 1279 | (setq blink-cursor-idle-timer nil |
| 1304 | (setq blink-cursor-idle-timer nil | 1280 | blink-cursor-timer nil) |
| 1305 | blink-cursor-timer nil | 1281 | (if blink-cursor-mode |
| 1306 | blink-cursor-mode nil) | 1282 | (progn |
| 1307 | (if on-p | 1283 | ;; Hide the cursor. |
| 1308 | (progn | 1284 | ;;(internal-show-cursor nil nil) |
| 1309 | ;; Hide the cursor. | 1285 | (setq blink-cursor-idle-timer |
| 1310 | ;(internal-show-cursor nil nil) | 1286 | (run-with-idle-timer blink-cursor-delay |
| 1311 | (setq blink-cursor-idle-timer | 1287 | blink-cursor-delay |
| 1312 | (run-with-idle-timer blink-cursor-delay | 1288 | 'blink-cursor-start))) |
| 1313 | blink-cursor-delay | 1289 | (internal-show-cursor nil t))) |
| 1314 | 'blink-cursor-start)) | 1290 | |
| 1315 | (setq blink-cursor-mode t)) | 1291 | (defvaralias 'blink-cursor 'blink-cursor-mode) |
| 1316 | (internal-show-cursor nil t)))) | 1292 | (make-obsolete-variable 'blink-cursor 'blink-cursor-mode "22.1") |
| 1317 | 1293 | ||
| 1318 | (defun blink-cursor-start () | 1294 | (defun blink-cursor-start () |
| 1319 | "Timer function called from the timer `blink-cursor-idle-timer'. | 1295 | "Timer function called from the timer `blink-cursor-idle-timer'. |
| @@ -1379,5 +1355,5 @@ Use Custom to set this variable to get the display updated." | |||
| 1379 | 1355 | ||
| 1380 | (provide 'frame) | 1356 | (provide 'frame) |
| 1381 | 1357 | ||
| 1382 | ;;; arch-tag: 82979c70-b8f2-4306-b2ad-ddbd6b328b56 | 1358 | ;; arch-tag: 82979c70-b8f2-4306-b2ad-ddbd6b328b56 |
| 1383 | ;;; frame.el ends here | 1359 | ;;; frame.el ends here |