diff options
| author | Richard M. Stallman | 1996-02-27 17:44:45 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-02-27 17:44:45 +0000 |
| commit | 243dfffb77a01499d52e76409c5aba8b97527364 (patch) | |
| tree | ebc106b703c50e786d1d48084c033750e2c840c6 | |
| parent | 01937013f02f575c4e343b8d62d516f37007a51b (diff) | |
| download | emacs-243dfffb77a01499d52e76409c5aba8b97527364.tar.gz emacs-243dfffb77a01499d52e76409c5aba8b97527364.zip | |
(display-time): Use run-at-time to start the timer.
| -rw-r--r-- | lisp/time.el | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lisp/time.el b/lisp/time.el index 76c3b08bbdd..b6cc833ca4e 100644 --- a/lisp/time.el +++ b/lisp/time.el | |||
| @@ -63,18 +63,15 @@ If `display-time-day-and-date' is non-nil, the current day and date | |||
| 63 | are displayed as well. | 63 | are displayed as well. |
| 64 | After each update, `display-time-hook' is run with `run-hooks'." | 64 | After each update, `display-time-hook' is run with `run-hooks'." |
| 65 | (interactive) | 65 | (interactive) |
| 66 | (require 'timer) | ||
| 67 | (if (timerp display-time-timer) | ||
| 68 | (cancel-timer display-time-timer) | ||
| 69 | (setq display-time-timer (timer-create))) | ||
| 70 | (setq display-time-string "") | 66 | (setq display-time-string "") |
| 71 | (or global-mode-string (setq global-mode-string '(""))) | 67 | (or global-mode-string (setq global-mode-string '(""))) |
| 72 | (or (memq 'display-time-string global-mode-string) | 68 | (or (memq 'display-time-string global-mode-string) |
| 73 | (setq global-mode-string | 69 | (setq global-mode-string |
| 74 | (append global-mode-string '(display-time-string)))) | 70 | (append global-mode-string '(display-time-string)))) |
| 75 | (timer-set-time display-time-timer (current-time) display-time-interval) | 71 | ;; Setup the time timer. |
| 76 | (timer-set-function display-time-timer 'display-time-event-handler) | 72 | (and display-time-timer (cancel-timer display-time-timer)) |
| 77 | (timer-activate display-time-timer) | 73 | (setq display-time-timer |
| 74 | (run-at-time nil display-time-interval 'display-time-event-handler)) | ||
| 78 | ;; When you get new mail, clear "Mail" from the mode line. | 75 | ;; When you get new mail, clear "Mail" from the mode line. |
| 79 | (add-hook 'rmail-get-new-mail-hook 'display-time-event-handler)) | 76 | (add-hook 'rmail-get-new-mail-hook 'display-time-event-handler)) |
| 80 | 77 | ||