]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow display-time-mail-function to return nil
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Thu, 14 Jul 2011 14:30:35 +0000 (16:30 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Thu, 14 Jul 2011 14:30:35 +0000 (16:30 +0200)
* time.el (display-time-update): Allow
`display-time-mail-function' to return nil (bug#7158).  Fix
suggested by Detlev Zundel.

lisp/ChangeLog
lisp/time.el

index 22574223e748acf8a756adc1bdcb51cefe1d2ef7..0ac477dd68851d7fcfcbd2a63b66ac814b208e01 100644 (file)
@@ -1,5 +1,9 @@
 2011-07-14  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * time.el (display-time-update): Allow
+       `display-time-mail-function' to return nil (bug#7158).  Fix
+       suggested by Detlev Zundel.
+
        * vc/diff.el (diff): Clarify the order the file names are read
        (bug#7111).
 
index 7d752c85d4d66f8dec12162cd7f09f4fa9e07fc5..b158ef64691007be0f5822063bc23b2754910123 100644 (file)
@@ -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))))