aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Janík2002-01-27 18:14:55 +0000
committerPavel Janík2002-01-27 18:14:55 +0000
commitcc351ed49713cb64759283c0513d43ec4effcdbf (patch)
tree9f7f0bad5e253258cba9ecbc54c8805dd8ccb922
parentbaf10d8f55df000f695eea9da951d682f86ce197 (diff)
downloademacs-cc351ed49713cb64759283c0513d43ec4effcdbf.tar.gz
emacs-cc351ed49713cb64759283c0513d43ec4effcdbf.zip
(display-time-mail-directory): New option.
(display-time-mail-function): Update doc-string. (display-time-mail-icon): Use XPM image when available. (display-time-string-forms): Use more descriptive text as help-echo property. (display-time-mail-check-directory): New function. (display-time-update): Use it.
-rw-r--r--lisp/time.el33
1 files changed, 29 insertions, 4 deletions
diff --git a/lisp/time.el b/lisp/time.el
index 8bf3bcf8f3f..92494e5419f 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -1,6 +1,6 @@
1;;; time.el --- display time, load and mail indicator in mode line of Emacs 1;;; time.el --- display time, load and mail indicator in mode line of Emacs
2 2
3;; Copyright (C) 1985, 86, 87, 93, 94, 96, 2000, 2001 3;; Copyright (C) 1985, 86, 87, 93, 94, 96, 2000, 2001, 2002
4;; Free Software Foundation, Inc. 4;; Free Software Foundation, Inc.
5 5
6;; Maintainer: FSF 6;; Maintainer: FSF
@@ -44,9 +44,18 @@ default, which is system-dependent, and is the same as used by Rmail."
44 (file :format "%v")) 44 (file :format "%v"))
45 :group 'display-time) 45 :group 'display-time)
46 46
47(defcustom display-time-mail-directory nil
48 "*Name of mail inbox directory, for indicating existence of new mail.
49Non-nil and not a string means don't check for mail.
50When nil, no checking for mail in directory is done."
51 :type '(choice (const :tag "None" nil)
52 (directory :format "%v"))
53 :group 'display-time)
54
47(defcustom display-time-mail-function nil 55(defcustom display-time-mail-function nil
48 "*Function to call, for indicating existence of new mail. 56 "*Function to call, for indicating existence of new mail.
49nil means use the default method of checking `display-time-mail-file'." 57nil means use the default method of checking `display-time-mail-file'
58or files in `display-time-mail-directory'."
50 :type '(choice (const :tag "Default" nil) 59 :type '(choice (const :tag "Default" nil)
51 (function)) 60 (function))
52 :group 'display-time) 61 :group 'display-time)
@@ -118,7 +127,8 @@ display."
118 :type 'face) 127 :type 'face)
119 128
120(defvar display-time-mail-icon 129(defvar display-time-mail-icon
121 (find-image '((:type xbm :file "letter.xbm" :ascent center))) 130 (find-image '((:type xpm :file "letter.xpm" :ascent center)
131 (:type xbm :file "letter.xbm" :ascent center)))
122 "Image specification to offer as the mail indicator on a graphic 132 "Image specification to offer as the mail indicator on a graphic
123display. See `display-time-use-mail-icon' and 133display. See `display-time-use-mail-icon' and
124`display-time-mail-face'.") 134`display-time-mail-face'.")
@@ -158,7 +168,7 @@ depend on `display-time-day-and-date' and `display-time-24hr-format'."
158 ,@(list :background (face-attribute 168 ,@(list :background (face-attribute
159 display-time-mail-face 169 display-time-mail-face
160 :background))) 170 :background)))
161 'help-echo "mouse-2: Read mail" 171 'help-echo "You have new mail; mouse-2: Read mail"
162 'local-map (make-mode-line-mouse-map 'mouse-2 172 'local-map (make-mode-line-mouse-map 'mouse-2
163 read-mail-command))) 173 read-mail-command)))
164 "")) 174 ""))
@@ -214,6 +224,19 @@ would give mode line times like `94/12/30 21:07:48 (UTC)'."
214 (display-time-update) 224 (display-time-update)
215 (sit-for 0)) 225 (sit-for 0))
216 226
227(defun display-time-mail-check-directory ()
228 (let ((mail-files (directory-files display-time-mail-directory t))
229 (size 0))
230 (while (and mail-files (= size 0))
231 ;; Count size of regular files only.
232 (setq size (+ size (or (and (file-regular-p (car mail-files))
233 (nth 7 (file-attributes (car mail-files))))
234 0)))
235 (setq mail-files (cdr mail-files)))
236 (if (> size 0)
237 size
238 nil)))
239
217;; Update the display-time info for the mode line 240;; Update the display-time info for the mode line
218;; but don't redisplay right now. This is used for 241;; but don't redisplay right now. This is used for
219;; things like Rmail `g' that want to force an update 242;; things like Rmail `g' that want to force an update
@@ -247,6 +270,8 @@ would give mode line times like `94/12/30 21:07:48 (UTC)'."
247 (user-login-name)))) 270 (user-login-name))))
248 (mail (or (and display-time-mail-function 271 (mail (or (and display-time-mail-function
249 (funcall display-time-mail-function)) 272 (funcall display-time-mail-function))
273 (and display-time-mail-directory
274 (display-time-mail-check-directory))
250 (and (stringp mail-spool-file) 275 (and (stringp mail-spool-file)
251 (or (null display-time-server-down-time) 276 (or (null display-time-server-down-time)
252 ;; If have been down for 20 min, try again. 277 ;; If have been down for 20 min, try again.