annotate lisp/packages/time.el @ 116:9f59509498e1 r20-1b10

Import from CVS: tag r20-1b10
author cvs
date Mon, 13 Aug 2007 09:23:06 +0200
parents 8619ce7e4c50
children 7d55a9ba150c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; time.el --- display time and load in mode line of Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
3 ;; Copyright (C) 1985, 86, 87, 93, 94, 1996 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
5 ;; Maintainer: FSF, XEmacs add-ons (C) by Jens T. Lautenbacher
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
6 ;; mail <jens@lemming0.lem.uni-karlsruhe.de>
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
7 ;; for comments/fixes about the enhancements.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; along with XEmacs; see the file COPYING. If not, write to the Free
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
24 ;; 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
26 ;;; Version: 1.10 (I choose the version number starting at 1.1
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
27 ;;; to indicate that 1.0 was the old version
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
28 ;;; before I hacked away on it -jtl)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
29
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
30 ;;; Synched up with: Not synched with FSF.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
34 ;; Facilities to display current time/date and a new-mail indicator
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
35 ;; in the Emacs mode line. The single entry point is `display-time'.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
37 ;; See also reportmail.el.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
38 ;; This uses the XEmacs timeout-event mechanism, via a version
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
39 ;; of Kyle Jones' itimer package.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
41 ;;; jtl: This is in a wide part reworked for XEmacs so it won't use
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
42 ;;; the old mechanism for specifying what is to be displayed.
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
43 ;;; The starting variable to look at is `display-time-form-list'
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
44
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
45 ;;; It's more advanced features include heavy use of `balloon-help' a
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
46 ;;; package again written by Kyle Jones. You need to load this
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
47 ;;; explicitely on your own because I don't think a package should make
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
48 ;;; decisions which have a global effect (if you want to use it, a
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
49 ;;; (require 'balloon-help) in your .emacs should work. But look at the
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
50 ;;; documentation in balloon-help.el itself).
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
51
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
52 ;;; Thanks to Mike Scheidler for the idea to make the time led's fore- and
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
53 ;;; background color customizable
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
54
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (require 'itimer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
59 (defgroup display-time nil
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
60 "Facilities to display the current time/date/load and a new-mail indicator
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
61 in the XEmacs mode line or echo area."
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
62 :group 'applications)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
63
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
64 (defcustom display-time-mail-file nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 "*File name of mail inbox file, for indicating existence of new mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 Non-nil and not a string means don't check for mail. nil means use
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
67 default, which is system-dependent, and is the same as used by Rmail."
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
68 :group 'display-time)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;;;###autoload
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
71 (defcustom display-time-day-and-date nil
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
72 "*Non-nil means \\[display-time] should display day,date and time.
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
73 This affects the spec 'date in the variable display-time-form-list."
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
74 :group 'display-time
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
75 :type 'boolean)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
77 (defcustom display-time-interval 20
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
78 "*Seconds between updates of time in the mode line."
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
79 :group 'display-time
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
80 :type 'integer)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
82 (defcustom display-time-24hr-format nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 "*Non-nil indicates time should be displayed as hh:mm, 0 <= hh <= 23.
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
84 Nil means 1 <= hh <= 12, and an AM/PM suffix is used.
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
85 This affects the spec 'time in the variable display-time-form-list."
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
86 :group 'display-time
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
87 :type 'boolean)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
89 (defcustom display-time-echo-area nil
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
90 "*If non-nil, display-time will use the echo area instead of the mode line."
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
91 :group 'display-time
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
92 :type 'boolean)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (defvar display-time-string nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
96 (defcustom display-time-hook nil
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
97 "*List of functions to be called when the time is updated on the mode line."
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
98 :group 'display-time
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
99 :type 'hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (defvar display-time-server-down-time nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 "Time when mail file's file system was recorded to be down.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 If that file system seems to be up, the value is nil.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
105 (defcustom display-time-ignore-read-mail t
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
106 "*Non-nil means display the mail icon on any non-empty mailbox."
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
107 :group 'display-time
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
108 :type 'boolean)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
109
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (defun display-time ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 "Display current time, load level, and mail flag in mode line of each buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 Updates automatically every minute.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 If `display-time-day-and-date' is non-nil, the current day and date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 are displayed as well.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 After each update, `display-time-hook' is run with `run-hooks'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 If `display-time-echo-area' is non-nil, the time is displayed in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 echo area instead of in the mode-line."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 ;; if the "display-time" itimer already exists, nuke it first.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (let ((old (get-itimer "display-time")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (if old (delete-itimer old)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
123
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
124 (if (memq 'display-time-string global-mode-string)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
125 (setq global-mode-string
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
126 (remove 'display-time-string global-mode-string)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 ;; If we're not displaying the time in the echo area
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 ;; and the global mode string does not have a non-nil value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 ;; then initialize the global mode string's value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (or display-time-echo-area
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 global-mode-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (setq global-mode-string '("")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 ;; If we're not displaying the time in the echo area
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
134 ;; then we add our variable to the list. This will make the time
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 ;; appear on the modeline.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (or display-time-echo-area
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (setq global-mode-string
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
138 (append global-mode-string '(display-time-string))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 ;; Display the time initially...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (display-time-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 ;; ... and start an itimer to do it automatically thereafter.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 ;; If we wanted to be really clever about this, we could have the itimer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 ;; not be automatically restarted, but have it re-add itself each time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 ;; Then we could look at (current-time) and arrange for the itimer to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 ;; wake up exactly at the minute boundary. But that's just a little
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 ;; more work than it's worth...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (start-itimer "display-time" 'display-time-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 display-time-interval display-time-interval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
151 (defun display-time-stop ()
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
152 (interactive)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
153 (delete-itimer "display-time")
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
154 (setq display-time-string nil))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
155
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
156 (defcustom display-time-show-icons-maybe t
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
157 "Use icons for time, load and mail status if possible
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
158 and not specified different explicitely"
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
159 :group 'display-time
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
160 :type 'boolean)
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 70
diff changeset
161
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
162 (defvar display-time-icons-dir (concat data-directory "time/"))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 70
diff changeset
163
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
164 (defcustom display-time-mail-sign-string " Mail"
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
165 "The string used as mail indicator in the echo area
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
166 (and in the modeline if display-time-show-icons-maybe is nil)
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
167 if display-time-echo-area is t"
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
168 :group 'display-time
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
169 :type 'string)
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 70
diff changeset
170
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
171 (defcustom display-time-no-mail-sign-string ""
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
172 "The string used as no-mail indicator in the echo area
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
173 (and in the modeline if display-time-show-icons-maybe is nil)
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
174 if display-time-echo-area is t"
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
175 :group 'display-time
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
176 :type 'string)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
177
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
178 (defcustom display-time-display-pad "grey35"
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
179 "How the load indicator's trapezoidal \"pad\" is to be displayed.
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
180 This can be 'transparent or a string describing the color it should have"
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
181 :group 'display-time
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
182 :type '(choice :tag "Value"
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
183 (const transparent)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
184 (string :tag "Color")))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
185
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
186 (defcustom display-time-display-time-foreground "firebrick"
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
187 "How the time LEDs foreground is to be displayed.
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
188 This can be 'modeline (foreground color of the Modeline)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
189 or a string describing the color it should have"
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
190 :group 'display-time
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
191 :type '(choice :tag "Value"
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
192 (const modline)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
193 (string :tag "Color")))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
194
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
195 (defcustom display-time-display-time-background 'transparent
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
196 "How the time LEDs background is to be displayed.
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
197 This can be 'transparent or a string describing the color it should have"
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
198 :group 'display-time
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
199 :type '(choice :tag "Value"
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
200 (const transparent)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
201 (string :tag "Color")))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
202
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
203 (defcustom display-time-mail-balloon 'display-time-mail-balloon
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
204 "What to use to generate the ballon frame of the \"mail\" glyph
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
205 if balloon-help is loaded. This can be the function
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
206 display-time-mail-balloon, nil or a string."
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
207 :group 'display-time
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
208 :type '(choice (const display-time-mail-balloon)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
209 (const nil)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
210 (string)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
211
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
212 (defcustom display-time-no-mail-balloon "No mail is good mail."
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
213 "The string used in the ballon frame of the \"no mail\" glyph
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
214 if balloon-help is loaded. This can also be nil"
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
215 :group 'display-time
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
216 :type '(choice (const nil)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
217 (string)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
218
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
219 (defcustom display-time-mail-balloon-show-gnus-group nil
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
220 "Show the mail group gnus would put this message in.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
221 This is only useful if you use gnus to read your mail and have set the variable
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
222 nnmail-split-methods to split your incoming mail into different groups.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
223 Look at the documentation for gnus. If you don't know what we're talking about,
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
224 don't care and leave this set to nil"
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
225 :group 'display-time
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
226 :type 'boolean)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
227
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
228 (defface display-time-mail-balloon-enhance-face '((t (:background "orange")))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
229 "Face used for entries in the mail balloon which match the regexp
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
230 display-time-mail-balloon-enhance"
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
231 :group 'display-time)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
232
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
233 (defface display-time-mail-balloon-gnus-group-face '((t (:foreground "blue")))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
234 "Face used for the gnus group entry in the mail balloon
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
235 if display-time-mail-balloon-show-gnus-group is t (see the documentation there
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
236 before you set it to t)"
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
237 :group 'display-time)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
238
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
239 (defcustom display-time-mail-balloon-max-displayed 10
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
240 "The maximum number of messaged which are displayed in the mail balloon.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
241 You need to have balloon-help loaded to use this."
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
242 :group 'display-time
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
243 :type 'number)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
244
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
245 (defcustom display-time-mail-balloon-from-width 20
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
246 "The width of the `From:' part of the mail balloon.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
247 You need to have ballon-help loaded to use this"
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
248 :group 'display-time
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
249 :type 'number)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
250
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
251 (defcustom display-time-mail-balloon-subject-width 25
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
252 "The width of the `Subject:' part of the mail balloon.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
253 You need to have ballon-help loaded to use this"
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
254 :group 'display-time
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
255 :type 'number)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
256
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
257 (defcustom display-time-mail-balloon-gnus-split-width 10
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
258 "The width of the `Gnus Mail Group' part of the mail balloon.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
259 This denotes the mail group gnus would decide to put this message in.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
260 For getting this information, it consults the relevant variables from gnus
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
261 (nnmail-split-methods).
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
262 You need to have ballon-help loaded to use this"
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
263 :group 'display-time
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
264 :type 'number)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
265
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
266 (defcustom display-time-mail-balloon-enhance nil
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
267 "A list of regular expressions describing which messages should be highlighted
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
268 in the mail balloon. The regexp will be matched against the complete header block
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
269 of an email. You need to load balloon-help to use this"
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
270 :group 'display-time
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
271 :type '(repeat (string :tag "Regexp")))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
272
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
273 (defcustom display-time-mail-balloon-suppress nil
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
274 "A list of regular expressions describing which messages should be completely suppressed
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
275 in the mail balloon. The regexp will be matched against the complete header block
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
276 of an email. It will only take effect if the message is not matched already
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
277 by display-time-mail-balloon-enhance.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
278 You need to load balloon-help to use this"
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
279 :group 'display-time
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
280 :type '(repeat (string :tag "Regexp")))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
281
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
282 (defcustom display-time-mail-balloon-enhance-gnus-group nil
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
283 "A list of regular expressions describing which messages should be highlighted
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
284 in the mail balloon. The regexp will be matched against the group gnus would stuff
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
285 this message into. It will only take effect if the message is not matched already
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
286 by display-time-mail-balloon-suppress.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
287
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
288 This requires display-time-mail-balloon-show-gnus-group to be t
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
289 and balloon-help to be loaded"
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
290 :group 'display-time
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
291 :type '(repeat (string :tag "Regexp")))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
292
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
293 (defcustom display-time-mail-balloon-suppress-gnus-group nil
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
294 "A list of regular expressions describing which messages should be completely suppressed
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
295 in the mail balloon. The regexp will be matched against the group gnus would stuff
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
296 this message into. It will only take effect if the message is not matched already
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
297 by display-time-mail-balloon-enhance or display-time-mail-balloon-enhance-gnus-group.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
298
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
299 This requires display-time-mail-balloon-show-gnus-group to be t
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
300 and balloon-help to be loaded"
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
301 :group 'display-time
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
302 :type '(repeat (string :tag "Regexp")))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
303
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
304 (defvar display-time-spool-file-modification nil)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
305
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
306 (defvar display-time-mail-header nil)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
307
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
308 (defvar display-time-temp-buffer " *Display-time-temp-buffer*")
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
309
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
310 (defvar display-time-display-pad-old nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
311
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
312 (defvar display-time-display-time-fg-old nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
313
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
314 (defvar display-time-display-time-bg-old nil)
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 70
diff changeset
315
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
316 (defcustom display-time-load-list
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
317 (list 0.2 0.5 0.8 1.1 1.8 2.6)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
318 "*A list giving six thresholds for the load
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
319 which correspond to the six different icons to be displayed
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
320 as a load indicator"
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
321 :group 'display-time
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
322 :type '(list (number :tag "Threshold 1")
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
323 (number :tag "Threshold 2")
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
324 (number :tag "Threshold 3")
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
325 (number :tag "Threshold 4")
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
326 (number :tag "Threshold 5")
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
327 (number :tag "Threshold 6")))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
328
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
329 (defcustom display-time-compatible nil
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
330 "*This variable may be set to t to get the old behaviour of display-time.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
331 It should be considered obsolete and only be used if you really want the
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
332 old behaviour (eq. you made extensive customizations yourself).
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
333 This means no display of a spiffy mail icon or use of the
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
334 display-time-form-list instead of the old display-time-string-form."
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
335 :group 'display-time
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
336 :type 'boolean)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
337
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
338 (defun display-time-string-to-char-list (str)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
339 (mapcar (function identity) str))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
340
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
341 (defun display-time-generate-load-glyphs (&optional force)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
342 (let* ((pad-color (if (symbolp display-time-display-pad)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
343 (list "pad-color" '(face-background 'modeline))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
344 (list "pad-color" display-time-display-pad)))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
345 (xpm-color-symbols (append (list pad-color) xpm-color-symbols)))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
346 (if (and (featurep 'xpm)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
347 (or force (not (equal display-time-display-pad
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
348 display-time-display-pad-old))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
349 (progn
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
350 (setq display-time-load-0.0-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
351 (cons (make-extent nil nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
352 (make-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
353 (concat display-time-icons-dir "l-0.0.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
354 (setq display-time-load-0.5-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
355 (cons (make-extent nil nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
356 (make-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
357 (concat display-time-icons-dir "l-0.5.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
358 (setq display-time-load-1.0-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
359 (cons (make-extent nil nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
360 (make-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
361 (concat display-time-icons-dir "l-1.0.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
362 (setq display-time-load-1.5-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
363 (cons (make-extent nil nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
364 (make-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
365 (concat display-time-icons-dir "l-1.5.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
366 (setq display-time-load-2.0-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
367 (cons (make-extent nil nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
368 (make-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
369 (concat display-time-icons-dir "l-2.0.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
370 (setq display-time-load-2.5-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
371 (cons (make-extent nil nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
372 (make-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
373 (concat display-time-icons-dir "l-2.5.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
374 (setq display-time-load-3.0-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
375 (cons (make-extent nil nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
376 (make-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
377 (concat display-time-icons-dir "l-3.0.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
378 (setq display-time-display-pad-old display-time-display-pad)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
379 ))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
380
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
381
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
382 (defun display-time-generate-time-glyphs (&optional force)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
383 (let* ((ledbg (if (symbolp display-time-display-time-background)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
384 (list "ledbg" '(face-background 'modeline))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
385 (list "ledbg" display-time-display-time-background)))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
386 (ledfg (if (symbolp display-time-display-time-foreground)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
387 (list "ledfg" '(face-foreground 'modeline))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
388 (list "ledfg" display-time-display-time-foreground)))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
389 (xpm-color-symbols (append (list ledbg)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
390 (list ledfg) xpm-color-symbols)))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
391 (if (and (featurep 'xpm)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
392 (or force (not (equal display-time-display-time-background
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
393 display-time-display-time-bg-old))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
394 (not (equal display-time-display-time-foreground
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
395 display-time-display-time-fg-old))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
396 (progn
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
397 (setq display-time-1-glyph
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
398 (cons (make-extent nil nil)
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
399 (make-glyph (concat display-time-icons-dir "1.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
400 (setq display-time-2-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
401 (cons (make-extent nil nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
402 (make-glyph (concat display-time-icons-dir "2.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
403 (setq display-time-3-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
404 (cons (make-extent nil nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
405 (make-glyph (concat display-time-icons-dir "3.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
406 (setq display-time-4-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
407 (cons (make-extent nil nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
408 (make-glyph (concat display-time-icons-dir "4.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
409 (setq display-time-5-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
410 (cons (make-extent nil nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
411 (make-glyph (concat display-time-icons-dir "5.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
412 (setq display-time-6-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
413 (cons (make-extent nil nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
414 (make-glyph (concat display-time-icons-dir "6.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
415 (setq display-time-7-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
416 (cons (make-extent nil nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
417 (make-glyph (concat display-time-icons-dir "7.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
418 (setq display-time-8-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
419 (cons (make-extent nil nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
420 (make-glyph (concat display-time-icons-dir "8.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
421 (setq display-time-9-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
422 (cons (make-extent nil nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
423 (make-glyph (concat display-time-icons-dir "9.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
424 (setq display-time-0-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
425 (cons (make-extent nil nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
426 (make-glyph (concat display-time-icons-dir "0.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
427 (setq display-time-:-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
428 (cons (make-extent nil nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
429 (make-glyph (concat display-time-icons-dir "dp.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
430 (setq display-time-am-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
431 (cons (make-extent nil nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
432 (make-glyph (concat display-time-icons-dir "am.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
433 (setq display-time-pm-glyph
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
434 (cons (make-extent nil nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
435 (make-glyph (concat display-time-icons-dir "pm.xpm"))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
436 (setq display-time-display-time-fg-old
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
437 display-time-display-time-foreground
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
438 display-time-display-time-bg-old
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
439 display-time-display-time-background)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
440 ))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
441
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
442 (if (featurep 'xpm)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
443 (progn
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
444 (defvar display-time-mail-sign
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
445 (cons (make-extent nil nil)
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
446 (make-glyph (concat display-time-icons-dir "letter.xpm"))))
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
447 (set-extent-property (car display-time-mail-sign) 'balloon-help
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
448 'display-time-mail-balloon)
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
449 (defvar display-time-no-mail-sign
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
450 (cons (make-extent nil nil)
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
451 (make-glyph (concat display-time-icons-dir "no-letter.xpm"))))
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
452 (set-extent-property (car display-time-no-mail-sign) 'balloon-help
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
453 display-time-no-mail-balloon)
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
454 (defvar display-time-1-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
455 (defvar display-time-2-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
456 (defvar display-time-3-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
457 (defvar display-time-4-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
458 (defvar display-time-5-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
459 (defvar display-time-6-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
460 (defvar display-time-7-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
461 (defvar display-time-8-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
462 (defvar display-time-9-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
463 (defvar display-time-0-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
464 (defvar display-time-:-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
465 (defvar display-time-am-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
466 (defvar display-time-pm-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
467 (defvar display-time-load-0.0-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
468 (defvar display-time-load-0.5-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
469 (defvar display-time-load-1.0-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
470 (defvar display-time-load-1.5-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
471 (defvar display-time-load-2.0-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
472 (defvar display-time-load-2.5-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
473 (defvar display-time-load-3.0-glyph nil)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
474 (display-time-generate-time-glyphs 'force)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
475 (display-time-generate-load-glyphs 'force)
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
476 ))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 70
diff changeset
477
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
478 (defun display-time-can-do-graphical-display (&optional textual)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
479 (and display-time-show-icons-maybe
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
480 (not textual)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
481 (eq (console-type) 'x)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
482 (featurep 'xpm)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
483 (not display-time-echo-area)))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
484
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
485
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
486 (defun display-time-convert-num (time-string &optional textual)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
487 (let ((list (display-time-string-to-char-list time-string))
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
488 elem tmp balloon-help balloon-ext)
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
489 (if (not (display-time-can-do-graphical-display textual)) time-string
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
490 (display-time-generate-time-glyphs)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
491 (setq balloon-help
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
492 (format "%s, %s %s %s %s" dayname day monthname year
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
493 (concat " Average load:"
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
494 (if (not (equal load ""))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
495 load
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
496 " 0"))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
497 (setq balloon-ext (make-extent 0 (length balloon-help) balloon-help))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
498 (set-extent-property balloon-ext 'face 'red)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
499 (set-extent-property balloon-ext 'duplicable 't)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
500 (while (setq elem (pop list))
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
501 (setq elem
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
502 (eval (intern-soft (concat "display-time-"
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
503 (char-to-string elem)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
504 "-glyph"))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
505 (set-extent-property (car elem) 'balloon-help balloon-help)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
506 (push elem tmp))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
507 (reverse tmp))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
508
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
509 (defun display-time-convert-load (load-string &optional textual)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
510 (let ((load-number (string-to-number load-string))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
511 (alist (list (cons 0.0 0.0)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
512 (cons 0.5 (car display-time-load-list))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
513 (cons 1.0 (cadr display-time-load-list))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
514 (cons 1.5 (caddr display-time-load-list))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
515 (cons 2.0 (cadddr display-time-load-list))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
516 (cons 2.5 (cadr (cdddr display-time-load-list)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
517 (cons 3.0 (caddr (cdddr display-time-load-list)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
518 (cons 100000 100000)))
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
519 elem load-elem)
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
520 (if (not (display-time-can-do-graphical-display textual))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
521 load-string
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
522 (display-time-generate-load-glyphs)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
523 (while (>= load-number (cdr (setq elem (pop alist))))
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
524 (setq load-elem elem))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
525 (eval (intern-soft (concat "display-time-load-"
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
526 (number-to-string (car load-elem))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
527 "-glyph"))))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
528
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
529 (defun display-time-convert-am-pm (ampm-string &optional textual)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
530 (if (not (display-time-can-do-graphical-display textual))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
531 ampm-string
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
532 (cond ((equal ampm-string "am") display-time-am-glyph)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
533 ((equal ampm-string "pm") display-time-pm-glyph))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
534
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
535 (defun display-time-mail-balloon (&rest ciao)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
536 (let* ((mail-spool-file (or display-time-mail-file
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
537 (getenv "MAIL")
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
538 (concat rmail-spool-directory
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
539 (user-login-name))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
540 (show-split (and display-time-mail-balloon-show-gnus-group
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
541 (or (featurep 'nnmail) (require 'nnmail))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
542 (display-time-mail-balloon-gnus-split-width
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
543 (if (not show-split) 0
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
544 (+ 3 display-time-mail-balloon-gnus-split-width))) ; <space>[...] -> +3
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
545 (mod (nth 5 (file-attributes mail-spool-file)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
546 header header-ext)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
547 (setq header "You have mail:")
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
548 (setq header-ext
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
549 (make-extent 0 (length header) header))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
550 (set-extent-property header-ext 'face 'red)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
551 (set-extent-property header-ext 'duplicable t)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
552 (setq header (concat header "\n"
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
553 (make-string (+ display-time-mail-balloon-from-width
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
554 display-time-mail-balloon-subject-width
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
555 display-time-mail-balloon-gnus-split-width
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
556 3) (string-to-char "-"))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
557 (if (not (equal
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
558 mod display-time-spool-file-modification))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
559 (progn
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
560 (setq display-time-spool-file-modification mod)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
561 (setq display-time-mail-header
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
562 (display-time-scan-mail-file mail-spool-file show-split))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
563 (setq header (concat header display-time-mail-header))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
564 ))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
565
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
566
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
567 (defun display-time-scan-mail-file (file show-split)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
568 (let ((mail-headers "")
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
569 (nntp-server-buffer (get-buffer-create " *Display-Time-Split-Buffer*"))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
570 (suppress-count 0)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
571 (not-displayed 0)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
572 (i 0)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
573 (suppress-list display-time-mail-balloon-suppress)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
574 (enhance-list display-time-mail-balloon-enhance)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
575 (gnus-suppress-list display-time-mail-balloon-suppress-gnus-group)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
576 (gnus-enhance-list display-time-mail-balloon-enhance-gnus-group)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
577 mail-headers-list start end from subject gnus-group tmp
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
578 suppress enhance line line-ext
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
579 gnus-suppress-reg gnus-enhance-reg suppress-reg enhance-reg)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
580
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
581 (erase-buffer (get-buffer-create display-time-temp-buffer))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
582 (message "Scanning spool file...")
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
583 (while (setq tmp (pop enhance-list))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
584 (setq enhance-reg
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
585 (if (car enhance-list) (concat enhance-reg tmp "\\|")
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
586 (concat enhance-reg tmp))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
587 (while (setq tmp (pop suppress-list))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
588 (setq suppress-reg
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
589 (if (car suppress-list) (concat suppress-reg tmp "\\|")
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
590 (concat suppress-reg tmp))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
591 (while (setq tmp (pop gnus-enhance-list))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
592 (setq gnus-enhance-reg
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
593 (if (car gnus-enhance-list) (concat gnus-enhance-reg tmp "\\|")
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
594 (concat gnus-enhance-reg tmp))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
595 (while (setq tmp (pop gnus-suppress-list))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
596 (setq gnus-suppress-reg
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
597 (if (car gnus-suppress-list) (concat gnus-suppress-reg tmp "\\|")
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
598 (concat gnus-suppress-reg tmp))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
599 (save-excursion
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
600 (set-buffer display-time-temp-buffer)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
601 (setq case-fold-search nil)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
602 (insert-file-contents file)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
603 (goto-char (point-min))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
604 (while (setq start (re-search-forward "^From " nil t))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
605 (save-excursion
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
606 (setq end (re-search-forward "^$" nil t))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
607 (narrow-to-region start end)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
608 (goto-char (point-min))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
609 (setq enhance
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
610 (save-excursion
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
611 (if display-time-mail-balloon-enhance
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
612 (re-search-forward enhance-reg nil t))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
613 (if show-split
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
614 (save-excursion
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
615 (setq point (point-min))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
616 (nnmail-article-group '(lambda (name) (setq gnus-group name)))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
617
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
618 (if enhance () ; this takes prejudice over everything else
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
619 (setq suppress ; maybe set suppress only if not already enhanced
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
620 (save-excursion
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
621 (if display-time-mail-balloon-suppress
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
622 (re-search-forward suppress-reg nil t))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
623 (if suppress ()
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
624 (or (setq enhance ;;maybe we enhance because of the gnus group name
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
625 (save-excursion
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
626 (if (and show-split gnus-group
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
627 display-time-mail-balloon-enhance-gnus-group)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
628 (string-match gnus-enhance-reg gnus-group))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
629 (setq suppress ;; if we didn't enhance then maybe we have to suppress it?
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
630 (save-excursion
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
631 (if (and show-split gnus-group
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
632 display-time-mail-balloon-suppress-gnus-group)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
633 (string-match gnus-suppress-reg gnus-group)))))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
634
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
635 (setq from
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
636 (save-excursion
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
637 (re-search-forward "^From: \\(.*\\)" nil t)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
638 (mail-extract-address-components (match-string 1))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
639 (setq subject
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
640 (save-excursion
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
641 (re-search-forward "^Subject: \\(.*\\)" nil t)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
642 (match-string 1)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
643 (if suppress (setq suppress-count (1+ suppress-count))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
644 (if (car from) (setq from (car from))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
645 (setq from (cadr from)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
646 (if (> (length from) display-time-mail-balloon-from-width)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
647 (setq from (substring from 0
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
648 display-time-mail-balloon-from-width)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
649 (if (> (length subject) display-time-mail-balloon-subject-width)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
650 (setq subject (substring subject 0
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
651 display-time-mail-balloon-subject-width)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
652 (if (and show-split gnus-group
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
653 (> (length gnus-group)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
654 (- display-time-mail-balloon-gnus-split-width 3)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
655 (setq gnus-group (substring gnus-group 0
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
656 (- display-time-mail-balloon-gnus-split-width 3))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
657
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
658 (setq line (format (concat
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
659 "\n%-"(number-to-string
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
660 display-time-mail-balloon-from-width)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
661 "s [%-"(number-to-string
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
662 display-time-mail-balloon-subject-width)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
663 "s]")
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
664 from subject))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
665 (if (and show-split gnus-group)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
666 (setq line (concat line
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
667 (format
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
668 (concat
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
669 "-> %" (number-to-string
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
670 (- display-time-mail-balloon-gnus-split-width 3))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
671 "s") gnus-group))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
672 (if enhance
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
673 (progn
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
674 (setq line-ext (make-extent 1 (length line) line))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
675 (set-extent-property line-ext 'face
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
676 'display-time-mail-balloon-enhance-face)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
677 (set-extent-property line-ext 'duplicable t)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
678 (set-extent-property line-ext 'end-open t)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
679 (if (and show-split gnus-group)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
680 (progn
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
681 (setq line-ext (make-extent (- (length line)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
682 display-time-mail-balloon-gnus-split-width)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
683 (length line) line))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
684 (set-extent-property line-ext 'face
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
685 'display-time-mail-balloon-gnus-group-face)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
686 (set-extent-property line-ext 'duplicable t)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
687 (set-extent-property line-ext 'end-open t)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
688 (push line mail-headers-list))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
689 (setq point (point-max))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
690 (setq suppress nil
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
691 gnus-group nil
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
692 enhance nil)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
693 (widen)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
694 )))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
695 (if (> (length mail-headers-list) display-time-mail-balloon-max-displayed)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
696 (setq not-displayed (- (length mail-headers-list)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
697 display-time-mail-balloon-max-displayed)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
698 (while (< i display-time-mail-balloon-max-displayed)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
699 (setq mail-headers (concat mail-headers (pop mail-headers-list)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
700 (setq i (1+ i)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
701 (if (and (equal mail-headers "") (> suppress-count 0))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
702 (setq mail-headers "\nOnly junk mail..."))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
703 (concat mail-headers "\n"
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
704 (make-string (+ display-time-mail-balloon-from-width
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
705 display-time-mail-balloon-subject-width
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
706 display-time-mail-balloon-gnus-split-width
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
707 3) (string-to-char "-"))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
708 "\n"
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
709 (if (> not-displayed 0)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
710 (concat "More: " (number-to-string not-displayed)"\n"))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
711 (if (> suppress-count 0)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
712 (concat "Suppressed: " (number-to-string suppress-count)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
713 )))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
714
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
715
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
716 (defun display-time-mail-sign (&optional textual)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
717 "*A function giving back the object indicating 'mail' which
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
718 is the value of display-time-mail-sign when running under X,
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
719 display-time-echo-area is nil and display-time-show-icons-maybe is t.
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
720 It is the value of display-time-mail-sign-string otherwise or when
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
721 the optional parameter TEXTUAL is non-nil."
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
722 (if (not (display-time-can-do-graphical-display textual))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
723 display-time-mail-sign-string
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
724 (list " " display-time-mail-sign " ")))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
725
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
726 (defun display-time-no-mail-sign (&optional textual)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
727 "*A function giving back the object indicating 'no mail' which
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
728 is the value of display-time-no-mail-sign when running under X,
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
729 display-time-echo-area is nil and display-time-show-icons-maybe is t.
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
730 It is the value of display-time-no-mail-sign-string otherwise or when
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
731 the optional parameter TEXTUAL is non-nil."
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
732 (if (not (display-time-can-do-graphical-display textual))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
733 display-time-no-mail-sign-string
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
734 (list " " display-time-no-mail-sign " ")))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
735
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
736 (defcustom display-time-form-list
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
737 (list 'date 'time 'load 'mail)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
738 "*This list describes the format of the strings/glyphs
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
739 which are to be displayed by display-time.
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
740 The old variable display-time-string-forms is only used if
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
741 display-time-compatible is non-nil. It is a list consisting of
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
742 strings or any of the following symbols:
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
743
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
744 There are three complex specs whose behaviour is changed via
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
745 the setting of various variables
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
746
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
747 date: This prints out the date in a manner compatible to
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
748 the default value of the obsolete variable
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
749 display-time-string-forms. It respects the variable
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
750 display-time-day-and-date. If this is t it will print
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
751 out the current date in the form DAYNAME MONTH DAY
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
752 otherwise it will print nothing.
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
753
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
754 time: This prints out the time in a manner compatible to
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
755 the default value of the obsolete variable
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
756 display-time-string-forms. It respects the variable
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
757 display-time-24hr-format. If this is t it will print
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
758 out the current hours in 24-hour format, if nil the
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
759 hours will be printed in 12-hour format and the
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
760 minutes will be followed by 'AM' or 'PM'.
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
761
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
762 time-text: The same as above, but will not use a glyph
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
763
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
764 The other specs are simpler, as their meaning is not changed via
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
765 variables.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
766
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
767 24-hours: This prints the hours in 24-hours format
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
768
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
769 24-hours-text: The same as above, but will not use a glyph
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
770
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
771 12-hours: This prints the hours in 12-hours format
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
772
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
773 12-hours-text: The same as above, but will not use a glyph
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
774
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
775 am-pm: This prints am or pm.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
776
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
777 Timezone: This prints out the local timezone
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
778
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
779 am-pm-text: The same as above, but will not use a glyph
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
780
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
781 minutes: This prints the minutes.
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
782
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
783 minutes-text: The same as above, but will not use a glyph
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
784
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
785 day: This prints out the current day as a number.
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
786
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
787 dayname: This prints out today's name.
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
788
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
789 month: This prints out the current month as a number
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
790
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
791 monthname: This prints out the current month's name
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
792
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
793 year: This prints out the current year.
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
794
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
795 load: This prints out the system's load.
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
796
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
797 load-text: The same as above, but will not use a glyph
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
798
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
799 mail: This displays a mail indicator. Under X this will
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
800 normally be a small icon which changes depending if
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
801 there is new mail or not.
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
802
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
803 mail-text: The same as above, but will not use a glyph"
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
804 :group 'display-time
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
805 :type '(repeat (choice :tag "Symbol/String"
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
806 (const :tag "Date" date)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
807 (const :tag "Time" time)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
808 (const :tag "Time (text)" time-text)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
809 (const :tag "24 hour format" 24-hours)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
810 (const :tag "24 hour format (text)" 24-hours-text)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
811 (const :tag "12 hour format" 12-hours)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
812 (const :tag "12 hour format (text)" 12-hours-text)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
813 (const :tag "AM/PM indicator" am-pm)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
814 (const :tag "AM/PM indicator (text)" am-pm-text)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
815 (const :tag "Timezone" timezone)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
816 (const :tag "Minutes" minutes)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
817 (const :tag "Minutes (text)" minutes-text)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
818 (const :tag "Day" day)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
819 (const :tag "Dayname" dayname)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
820 (const :tag "Month" month)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
821 (const :tag "Monthname" monthname)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
822 (const :tag "Year" year)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
823 (const :tag "Load" load)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
824 (const :tag "Load (text)" load-text)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
825 (const :tag "Mail sign" mail)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
826 (const :tag "Mail sign (text)" mail-text)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
827 (string :tag "String"))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
828
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
829 (defun display-time-evaluate-list ()
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
830 "Evalute the variable display-time-form-list"
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
831 (let ((list display-time-form-list) elem tmp result)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
832 (while (setq elem (pop list))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
833 (cond ((stringp elem) (push elem tmp))
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
834 ((eq elem 'date)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
835 (push (if display-time-day-and-date
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
836 (format "%s %s %s " dayname monthname day) "") tmp))
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
837 ((eq elem 'time)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
838 (progn
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
839 (push (display-time-convert-num
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
840 (format "%s:%s"
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
841 (if display-time-24hr-format 24-hours 12-hours)
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
842 minutes)) tmp)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
843 (if (not display-time-24hr-format)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
844 (push (display-time-convert-am-pm am-pm) tmp))))
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
845 ((eq elem 'time-text)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
846 (push (display-time-convert-num
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
847 (format "%s:%s"
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
848 (if display-time-24hr-format 24-hours 12-hours)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
849 minutes) t) tmp)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
850 (if (not display-time-24hr-format)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
851 (push (display-time-convert-am-pm am-pm t) tmp)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
852 ((eq elem 'day) (push day tmp))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
853 ((eq elem 'dayname) (push dayname tmp))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
854 ((eq elem 'month) (push month tmp))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
855 ((eq elem 'monthname) (push monthname tmp))
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
856 ((eq elem '24-hours)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
857 (push (display-time-convert-num 24-hours) tmp))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
858 ((eq elem 'year)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
859 (push year tmp))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
860 ((eq elem '24-hours-text)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
861 (push (display-time-convert-num 24-hours t) tmp))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
862 ((eq elem '12-hours)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
863 (push (display-time-convert-num 12-hours) tmp))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
864 ((eq elem '12-hours-text)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
865 (push (display-time-convert-num 12-hours t) tmp))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
866 ((eq elem 'minutes)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
867 (push (display-time-convert-num minutes) tmp))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
868 ((eq elem 'minutes-text)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
869 (push (display-time-convert-num minutes t) tmp))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
870 ((eq elem 'am-pm)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
871 (push (display-time-convert-am-pm am-pm) tmp))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
872 ((eq elem 'am-pm-text)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
873 (push (display-time-convert-am-pm am-pm t) tmp))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
874 ((eq elem 'timezone)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
875 (push time-zone tmp))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
876 ((eq elem 'load)
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
877 (push (display-time-convert-load load) tmp))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
878 ((eq elem 'load-text)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
879 (push (display-time-convert-load load t) tmp))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
880 ((eq elem 'mail)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
881 (push (if mail (display-time-mail-sign)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
882 (display-time-no-mail-sign)) tmp))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
883 ((eq elem 'mail-text)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
884 (push (if mail (display-time-mail-sign t)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
885 (display-time-no-mail-sign t)) tmp))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
886 ))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
887 ;; We know that we have a list containing only of strings if
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
888 ;; display-time-echo-area is t. So we construct this string from
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
889 ;; the list. Else we just reverse the list and give it as result.
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
890 (if (not display-time-echo-area) (setq result (reverse tmp))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
891 (while (setq elem (pop tmp))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
892 (setq result (concat elem result))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
893 result))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
894
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
895
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 (defvar display-time-string-forms
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 '((if display-time-day-and-date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 (format "%s %s %s " dayname monthname day)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 (format "%s:%s%s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 (if display-time-24hr-format 24-hours 12-hours)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 minutes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 (if display-time-24hr-format "" am-pm))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
904 load
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
905 (if mail " Mail" ""))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
906 "*THIS IS OBSOLETE! It will only be used if display-time-compatible is t.
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
907 A list of expressions governing display of the time in the mode line.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 This expression is a list of expressions that can involve the keywords
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 `load', `day', `month', and `year', `12-hours', `24-hours', `minutes',
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 `seconds', all numbers in string form, and `monthname', `dayname', `am-pm',
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 70
diff changeset
911 and `time-zone' all alphabetic strings and `mail' a true/nil string value.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 For example, the form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 '((substring year -2) \"/\" month \"/\" day
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 \" \" 24-hours \":\" minutes \":\" seconds
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 70
diff changeset
917 (if time-zone \" (\") time-zone (if time-zone \")\"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 would give mode line times like `94/12/30 21:07:48 (UTC)'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 (defun display-time-function ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 (let* ((now (current-time))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 (time (current-time-string now))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 (load (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 (if (zerop (car (load-average))) ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 (let ((str (format " %03d" (car (load-average)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 (concat (substring str 0 -2) "." (substring str -2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 (error "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 (mail-spool-file (or display-time-mail-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 (getenv "MAIL")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 (concat rmail-spool-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 (user-login-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 (mail (and (stringp mail-spool-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 (or (null display-time-server-down-time)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 ;; If have been down for 20 min, try again.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 (> (- (nth 1 (current-time))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 display-time-server-down-time)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 1200))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 (let ((start-time (current-time)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 (display-time-file-nonempty-p mail-spool-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 (if (> (- (nth 1 (current-time)) (nth 1 start-time))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 20)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 ;; Record that mail file is not accessible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 (setq display-time-server-down-time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 (nth 1 (current-time)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 ;; Record that mail file is accessible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 (setq display-time-server-down-time nil))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 (24-hours (substring time 11 13))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 (hour (string-to-int 24-hours))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 (12-hours (int-to-string (1+ (% (+ hour 11) 12))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 (am-pm (if (>= hour 12) "pm" "am"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 (minutes (substring time 14 16))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 (seconds (substring time 17 19))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 (time-zone (car (cdr (current-time-zone now))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 (day (substring time 8 10))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 (year (substring time 20 24))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 (monthname (substring time 4 7))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 (month
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 (cdr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 (assoc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 monthname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 '(("Jan" . "1") ("Feb" . "2") ("Mar" . "3") ("Apr" . "4")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 ("May" . "5") ("Jun" . "6") ("Jul" . "7") ("Aug" . "8")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 ("Sep" . "9") ("Oct" . "10") ("Nov" . "11") ("Dec" . "12")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 (dayname (substring time 0 3)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 (setq display-time-string
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
968 (if display-time-compatible
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
969 (mapconcat 'eval display-time-string-forms "")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
970 (display-time-evaluate-list)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 ;; This is inside the let binding, but we are not going to document
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 ;; what variables are available.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 (run-hooks 'display-time-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (if display-time-echo-area
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 (or (> (minibuffer-depth) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 ;; don't stomp echo-area-buffer if reading from minibuffer now.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 (select-window (minibuffer-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 (erase-buffer)
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
981 (indent-to (- (frame-width) (length display-time-string) 1))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 (insert display-time-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 (message (buffer-string)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 (force-mode-line-update)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 ;; Do redisplay right now, if no input pending.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 (sit-for 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 (defun display-time-file-nonempty-p (file)
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
989 (let ((attributes (file-attributes (file-chase-links file))))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
990 (and attributes
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
991 (< 0 (nth 7 attributes))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
992 (or display-time-ignore-read-mail
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
993 (> (car (nth 5 attributes)) (car (nth 4 attributes)))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
994 (and (= (car (nth 5 attributes)) (car (nth 4 attributes)))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
995 (> (cadr (nth 5 attributes)) (cadr (nth 4 attributes))))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 (provide 'time)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 ;;; time.el ends here