comparison lisp/time.el @ 27239:c681a4318a92

(display-time-string-forms): Make the Mail string active. (display-time-update): Provide help-echo for load average.
author Dave Love <fx@gnu.org>
date Fri, 07 Jan 2000 14:19:23 +0000
parents 464b296e0b87
children 66e75f4824c8
comparison
equal deleted inserted replaced
27238:bfb9906d58b5 27239:c681a4318a92
1 ;;; time.el --- display time and load in mode line of Emacs. 1 ;;; time.el --- display time and load in mode line of Emacs.
2 2
3 ;; Copyright (C) 1985, 86, 87, 93, 94, 1996 Free Software Foundation, Inc. 3 ;; Copyright (C) 1985, 86, 87, 93, 94, 96, 2000 Free Software Foundation, Inc.
4 4
5 ;; Maintainer: FSF 5 ;; Maintainer: FSF
6 6
7 ;; This file is part of GNU Emacs. 7 ;; This file is part of GNU Emacs.
8 8
140 :type '(choice (const :tag "Default" nil) 140 :type '(choice (const :tag "Default" nil)
141 string) 141 string)
142 :group 'display-time) 142 :group 'display-time)
143 143
144 (defcustom display-time-string-forms 144 (defcustom display-time-string-forms
145 '((if (and (not display-time-format) display-time-day-and-date) 145 `((if (and (not display-time-format) display-time-day-and-date)
146 (format-time-string "%a %b %e " now) 146 (format-time-string "%a %b %e " now)
147 "") 147 "")
148 (format-time-string (or display-time-format 148 (format-time-string (or display-time-format
149 (if display-time-24hr-format "%H:%M" "%-I:%M%p")) 149 (if display-time-24hr-format "%H:%M" "%-I:%M%p"))
150 now) 150 now)
151 load 151 load
152 (if mail " Mail" "")) 152 (if mail ,(propertize " Mail"
153 'help-echo "mouse-2: Read mail"
154 'local-map (make-mode-line-mouse2-map
155 (lambda (e)
156 (interactive "e")
157 (funcall read-mail-command))))
158 ""))
153 "*A list of expressions governing display of the time in the mode line. 159 "*A list of expressions governing display of the time in the mode line.
154 For most purposes, you can control the time format using `display-time-format' 160 For most purposes, you can control the time format using `display-time-format'
155 which is a more standard interface. 161 which is a more standard interface.
156 162
157 This expression is a list of expressions that can involve the keywords 163 This expression is a list of expressions that can involve the keywords
202 (defun display-time-update () 208 (defun display-time-update ()
203 (let* ((now (current-time)) 209 (let* ((now (current-time))
204 (time (current-time-string now)) 210 (time (current-time-string now))
205 (load (condition-case () 211 (load (condition-case ()
206 (if (zerop (car (load-average))) "" 212 (if (zerop (car (load-average))) ""
213 ;; The load average number is myterious, so
214 ;; propvide some help.
207 (let ((str (format " %03d" (car (load-average))))) 215 (let ((str (format " %03d" (car (load-average)))))
208 (concat (substring str 0 -2) "." (substring str -2)))) 216 (propertize
217 (concat (substring str 0 -2) "." (substring str -2))
218 'help-echo "Load average")))
209 (error ""))) 219 (error "")))
210 (mail-spool-file (or display-time-mail-file 220 (mail-spool-file (or display-time-mail-file
211 (getenv "MAIL") 221 (getenv "MAIL")
212 (concat rmail-spool-directory 222 (concat rmail-spool-directory
213 (user-login-name)))) 223 (user-login-name))))