summaryrefslogtreecommitdiff
path: root/lisp/time.el
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen <larsi@gnus.org>2011-07-14 16:30:35 +0200
committerLars Magne Ingebrigtsen <larsi@gnus.org>2011-07-14 16:30:35 +0200
commitab283561c2832dea29658b355851b686f60d8dae (patch)
tree91ded66a9c97885dd5e5c31dd60bb779c4e3da7d /lisp/time.el
parent0c1362863ddaadf0176c951b9bbdb24514dfb2f4 (diff)
downloademacs-ab283561c2832dea29658b355851b686f60d8dae.tar.gz
Allow display-time-mail-function to return nil
* time.el (display-time-update): Allow `display-time-mail-function' to return nil (bug#7158). Fix suggested by Detlev Zundel.
Diffstat (limited to 'lisp/time.el')
-rw-r--r--lisp/time.el49
1 files changed, 25 insertions, 24 deletions
diff --git a/lisp/time.el b/lisp/time.el
index 7d752c85d4d..b158ef64691 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -423,30 +423,31 @@ update which can wait for the next redisplay."
(getenv "MAIL")
(concat rmail-spool-directory
(user-login-name))))
- (mail (or (and display-time-mail-function
- (funcall display-time-mail-function))
- (and display-time-mail-directory
- (display-time-mail-check-directory))
- (and (stringp mail-spool-file)
- (or (null display-time-server-down-time)
- ;; If have been down for 20 min, try again.
- (> (- (nth 1 now) display-time-server-down-time)
- 1200)
- (and (< (nth 1 now) display-time-server-down-time)
- (> (- (nth 1 now)
- display-time-server-down-time)
- -64336)))
- (let ((start-time (current-time)))
- (prog1
- (display-time-file-nonempty-p mail-spool-file)
- (if (> (- (nth 1 (current-time))
- (nth 1 start-time))
- 20)
- ;; Record that mail file is not accessible.
- (setq display-time-server-down-time
- (nth 1 (current-time)))
- ;; Record that mail file is accessible.
- (setq display-time-server-down-time nil)))))))
+ (mail (cond
+ (display-time-mail-function
+ (funcall display-time-mail-function))
+ (display-time-mail-directory
+ (display-time-mail-check-directory))
+ ((and (stringp mail-spool-file)
+ (or (null display-time-server-down-time)
+ ;; If have been down for 20 min, try again.
+ (> (- (nth 1 now) display-time-server-down-time)
+ 1200)
+ (and (< (nth 1 now) display-time-server-down-time)
+ (> (- (nth 1 now)
+ display-time-server-down-time)
+ -64336))))
+ (let ((start-time (current-time)))
+ (prog1
+ (display-time-file-nonempty-p mail-spool-file)
+ (if (> (- (nth 1 (current-time))
+ (nth 1 start-time))
+ 20)
+ ;; Record that mail file is not accessible.
+ (setq display-time-server-down-time
+ (nth 1 (current-time)))
+ ;; Record that mail file is accessible.
+ (setq display-time-server-down-time nil)))))))
(24-hours (substring time 11 13))
(hour (string-to-number 24-hours))
(12-hours (int-to-string (1+ (% (+ hour 11) 12))))