annotate lisp/packages/time.el @ 126:1370575f1259 xemacs-20-1p1

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