comparison lisp/time.el @ 17697:8ef3e5ff7ee2

Customize. (display-time-string-forms): Test display-time-day-and-date and display-time-24hr-format here. (display-time-format): Default value is now nil.
author Richard M. Stallman <rms@gnu.org>
date Thu, 08 May 1997 05:11:50 +0000
parents d73425ee186b
children 11218164bc54
comparison
equal deleted inserted replaced
17696:a30300999b49 17697:8ef3e5ff7ee2
26 ;; Facilities to display current time/date and a new-mail indicator 26 ;; Facilities to display current time/date and a new-mail indicator
27 ;; in the Emacs mode line. The single entry point is `display-time'. 27 ;; in the Emacs mode line. The single entry point is `display-time'.
28 28
29 ;;; Code: 29 ;;; Code:
30 30
31 (defvar display-time-mail-file nil 31 (defgroup display-time nil
32 "Display time and load in mode line of Emacs."
33 :group 'modeline
34 :group 'mail)
35
36
37 (defcustom display-time-mail-file nil
32 "*File name of mail inbox file, for indicating existence of new mail. 38 "*File name of mail inbox file, for indicating existence of new mail.
33 Non-nil and not a string means don't check for mail. nil means use 39 Non-nil and not a string means don't check for mail. nil means use
34 default, which is system-dependent, and is the same as used by Rmail.") 40 default, which is system-dependent, and is the same as used by Rmail."
41 :type '(choice (const :tag "Default" nil)
42 (file :format "%v"))
43 :group 'display-time)
35 44
36 ;;;###autoload 45 ;;;###autoload
37 (defvar display-time-day-and-date nil "\ 46 (defcustom display-time-day-and-date nil "\
38 *Non-nil means \\[display-time] should display day and date as well as time.") 47 *Non-nil means \\[display-time] should display day and date as well as time."
48 :type 'boolean
49 :group 'display-time)
39 50
40 (defvar display-time-timer nil) 51 (defvar display-time-timer nil)
41 52
42 (defvar display-time-interval 60 53 (defcustom display-time-interval 60
43 "*Seconds between updates of time in the mode line.") 54 "*Seconds between updates of time in the mode line."
44 55 :type 'integer
45 (defvar display-time-24hr-format nil 56 :group 'display-time)
57
58 (defcustom display-time-24hr-format nil
46 "*Non-nil indicates time should be displayed as hh:mm, 0 <= hh <= 23. 59 "*Non-nil indicates time should be displayed as hh:mm, 0 <= hh <= 23.
47 Nil means 1 <= hh <= 12, and an AM/PM suffix is used.") 60 Nil means 1 <= hh <= 12, and an AM/PM suffix is used."
61 :type 'boolean
62 :group 'display-time)
48 63
49 (defvar display-time-string nil) 64 (defvar display-time-string nil)
50 65
51 (defvar display-time-hook nil 66 (defcustom display-time-hook nil
52 "* List of functions to be called when the time is updated on the mode line.") 67 "* List of functions to be called when the time is updated on the mode line."
68 :type 'hook
69 :group 'display-time)
53 70
54 (defvar display-time-server-down-time nil 71 (defvar display-time-server-down-time nil
55 "Time when mail file's file system was recorded to be down. 72 "Time when mail file's file system was recorded to be down.
56 If that file system seems to be up, the value is nil.") 73 If that file system seems to be up, the value is nil.")
57 74
98 'display-time-event-handler)) 115 'display-time-event-handler))
99 (remove-hook 'rmail-after-get-new-mail-hook 116 (remove-hook 'rmail-after-get-new-mail-hook
100 'display-time-event-handler)))) 117 'display-time-event-handler))))
101 118
102 119
103 (defvar display-time-format nil 120 (defcustom display-time-format nil
104 "*A string specifying the format for displaying the time in the mode line. 121 "*A string specifying the format for displaying the time in the mode line.
105 See the function `format-time-string' for an explanation of 122 See the function `format-time-string' for an explanation of
106 how to write this string. If this is nil, the defaults 123 how to write this string. If this is nil, the defaults
107 depend on `display-time-day-and-date' and `display-time-24hr-format'.") 124 depend on `display-time-day-and-date' and `display-time-24hr-format'."
108 125 :type '(choice (const :tag "Default" nil)
109 (defvar display-time-string-forms 126 string)
127 :group 'display-time)
128
129 (defcustom display-time-string-forms
110 '((if (and (not display-time-format) display-time-day-and-date) 130 '((if (and (not display-time-format) display-time-day-and-date)
111 (format-time-string "%a %b %e " now) 131 (format-time-string "%a %b %e " now)
112 "") 132 "")
113 (format-time-string (or display-time-format 133 (format-time-string (or display-time-format
114 (if display-time-24hr-format "%H:%m" "%-I:%M%p")) 134 (if display-time-24hr-format "%H:%m" "%-I:%M%p"))
129 '((substring year -2) \"/\" month \"/\" day 149 '((substring year -2) \"/\" month \"/\" day
130 \" \" 24-hours \":\" minutes \":\" seconds 150 \" \" 24-hours \":\" minutes \":\" seconds
131 (if time-zone \" (\") time-zone (if time-zone \")\") 151 (if time-zone \" (\") time-zone (if time-zone \")\")
132 (if mail \" Mail\" \"\")) 152 (if mail \" Mail\" \"\"))
133 153
134 would give mode line times like `94/12/30 21:07:48 (UTC)'.") 154 would give mode line times like `94/12/30 21:07:48 (UTC)'."
155 :type 'sexp
156 :group 'display-time)
135 157
136 (defun display-time-event-handler () 158 (defun display-time-event-handler ()
137 (display-time-update) 159 (display-time-update)
138 ;; Do redisplay right now, if no input pending. 160 ;; Do redisplay right now, if no input pending.
139 (sit-for 0) 161 (sit-for 0)