]> code.delx.au - gnu-emacs/blobdiff - lisp/time.el
Load byte-run and format a little earlier.
[gnu-emacs] / lisp / time.el
index f66160b47186bf3385cded1474c351c6baedd0b4..d03b033884ad0ad144e1f5e96275510909119906 100644 (file)
   :group 'mail)
 
 
+(defcustom display-time-mode nil
+  "Toggle display of time, load level, and mail flag in mode lines.
+You must modify via \\[customize] for this variable to have an effect."
+  :set (lambda (symbol value)
+        (display-time-mode (or value 0)))
+  :initialize 'custom-initialize-default
+  :type 'boolean
+  :group 'display-time
+  :require 'time
+  :version "20.3")
+
+
 (defcustom display-time-mail-file nil
   "*File name of mail inbox file, for indicating existence of new mail.
 Non-nil and not a string means don't check for mail.  nil means use
@@ -64,7 +76,7 @@ Nil means 1 <= hh <= 12, and an AM/PM suffix is used."
 (defvar display-time-string nil)
 
 (defcustom display-time-hook nil
-  "* List of functions to be called when the time is updated on the mode line."
+  "*List of functions to be called when the time is updated on the mode line."
   :type 'hook
   :group 'display-time)
 
@@ -95,6 +107,7 @@ This runs the normal hook `display-time-hook' after each update."
   (let ((on (if (null arg)
                (not display-time-timer)
              (> (prefix-numeric-value arg) 0))))
+    (setq display-time-mode on)
     (and display-time-timer (cancel-timer display-time-timer))
     (setq display-time-timer nil)
     (setq display-time-string "")
@@ -131,7 +144,7 @@ depend on `display-time-day-and-date' and `display-time-24hr-format'."
        (format-time-string "%a %b %e " now)
       "")
     (format-time-string (or display-time-format
-                           (if display-time-24hr-format "%H:%m" "%-I:%M%p"))
+                           (if display-time-24hr-format "%H:%M" "%-I:%M%p"))
                        now)
     load
     (if mail " Mail" ""))
@@ -208,7 +221,7 @@ would give mode line times like `94/12/30 21:07:48 (UTC)'."
                        (if (> (- (nth 1 (current-time)) (nth 1 start-time))
                               20)
                            ;; Record that mail file is not accessible.
-                           (setq display-time-server-down-time 
+                           (setq display-time-server-down-time
                                  (nth 1 (current-time)))
                          ;; Record that mail file is accessible.
                          (setq display-time-server-down-time nil))))))
@@ -241,6 +254,9 @@ would give mode line times like `94/12/30 21:07:48 (UTC)'."
   (and (file-exists-p file)
        (< 0 (nth 7 (file-attributes (file-chase-links file))))))
 
+(if display-time-mode
+    (display-time-mode t))
+
 (provide 'time)
 
 ;;; time.el ends here