comparison lisp/frame.el @ 72484:f9400e50a0e5

(blink-cursor-end): Only ignore the error we care about. (blink-cursor-mode): Use blink-cursor-end to simplify the code.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 22 Aug 2006 01:35:45 +0000
parents 94094ff11364
children b8e9392042ae 694bbb62a75d 6823a91487f2
comparison
equal deleted inserted replaced
72483:a085a4e8fd54 72484:f9400e50a0e5
1251 (defvar blink-cursor-timer nil 1251 (defvar blink-cursor-timer nil
1252 "Timer started from `blink-cursor-start'. 1252 "Timer started from `blink-cursor-start'.
1253 This timer calls `blink-cursor-timer-function' every 1253 This timer calls `blink-cursor-timer-function' every
1254 `blink-cursor-interval' seconds.") 1254 `blink-cursor-interval' seconds.")
1255 1255
1256 (define-minor-mode blink-cursor-mode
1257 "Toggle blinking cursor mode.
1258 With a numeric argument, turn blinking cursor mode on iff ARG is positive.
1259 When blinking cursor mode is enabled, the cursor of the selected
1260 window blinks.
1261
1262 Note that this command is effective only when Emacs
1263 displays through a window system, because then Emacs does its own
1264 cursor display. On a text-only terminal, this is not implemented."
1265 :init-value (not (or noninteractive
1266 no-blinking-cursor
1267 (eq system-type 'ms-dos)
1268 (not (memq window-system '(x w32 mac)))))
1269 :initialize 'custom-initialize-safe-default
1270 :group 'cursor
1271 :global t
1272 (if blink-cursor-idle-timer (cancel-timer blink-cursor-idle-timer))
1273 (if blink-cursor-timer (cancel-timer blink-cursor-timer))
1274 (setq blink-cursor-idle-timer nil
1275 blink-cursor-timer nil)
1276 (if blink-cursor-mode
1277 (progn
1278 ;; Hide the cursor.
1279 ;;(internal-show-cursor nil nil)
1280 (setq blink-cursor-idle-timer
1281 (run-with-idle-timer blink-cursor-delay
1282 blink-cursor-delay
1283 'blink-cursor-start)))
1284 (internal-show-cursor nil t)))
1285
1286 (define-obsolete-variable-alias 'blink-cursor 'blink-cursor-mode "22.1")
1287
1288 (defun blink-cursor-start () 1256 (defun blink-cursor-start ()
1289 "Timer function called from the timer `blink-cursor-idle-timer'. 1257 "Timer function called from the timer `blink-cursor-idle-timer'.
1290 This starts the timer `blink-cursor-timer', which makes the cursor blink 1258 This starts the timer `blink-cursor-timer', which makes the cursor blink
1291 if appropriate. It also arranges to cancel that timer when the next 1259 if appropriate. It also arranges to cancel that timer when the next
1292 command starts, by installing a pre-command hook." 1260 command starts, by installing a pre-command hook."
1308 This is installed as a pre-command hook by `blink-cursor-start'. 1276 This is installed as a pre-command hook by `blink-cursor-start'.
1309 When run, it cancels the timer `blink-cursor-timer' and removes 1277 When run, it cancels the timer `blink-cursor-timer' and removes
1310 itself as a pre-command hook." 1278 itself as a pre-command hook."
1311 (remove-hook 'pre-command-hook 'blink-cursor-end) 1279 (remove-hook 'pre-command-hook 'blink-cursor-end)
1312 (internal-show-cursor nil t) 1280 (internal-show-cursor nil t)
1313 (condition-case nil 1281 (when blink-cursor-timer
1314 (cancel-timer blink-cursor-timer) 1282 (cancel-timer blink-cursor-timer)
1315 (error nil)) 1283 (setq blink-cursor-timer nil)))
1316 (setq blink-cursor-timer nil)) 1284
1317 1285 (define-minor-mode blink-cursor-mode
1286 "Toggle blinking cursor mode.
1287 With a numeric argument, turn blinking cursor mode on iff ARG is positive.
1288 When blinking cursor mode is enabled, the cursor of the selected
1289 window blinks.
1290
1291 Note that this command is effective only when Emacs
1292 displays through a window system, because then Emacs does its own
1293 cursor display. On a text-only terminal, this is not implemented."
1294 :init-value (not (or noninteractive
1295 no-blinking-cursor
1296 (eq system-type 'ms-dos)
1297 (not (memq window-system '(x w32 mac)))))
1298 :initialize 'custom-initialize-safe-default
1299 :group 'cursor
1300 :global t
1301 (if blink-cursor-idle-timer (cancel-timer blink-cursor-idle-timer))
1302 (setq blink-cursor-idle-timer nil)
1303 (blink-cursor-end)
1304 (when blink-cursor-mode
1305 ;; Hide the cursor.
1306 ;;(internal-show-cursor nil nil)
1307 (setq blink-cursor-idle-timer
1308 (run-with-idle-timer blink-cursor-delay
1309 blink-cursor-delay
1310 'blink-cursor-start))))
1311
1312 (define-obsolete-variable-alias 'blink-cursor 'blink-cursor-mode "22.1")
1318 1313
1319 ;; Hourglass pointer 1314 ;; Hourglass pointer
1320 1315
1321 (defcustom display-hourglass t 1316 (defcustom display-hourglass t
1322 "*Non-nil means show an hourglass pointer, when Emacs is busy. 1317 "*Non-nil means show an hourglass pointer, when Emacs is busy.