Mercurial > emacs
annotate lisp/time.el @ 16033:244188795475
(vc-register-switches): New variable.
(vc-backend-admin): Use vc-register-switches.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 01 Sep 1996 18:33:12 +0000 |
parents | 0e6def53a74f |
children | c477472563dd |
rev | line source |
---|---|
657
fec3f9a1e3e5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
387
diff
changeset
|
1 ;;; time.el --- display time and load in mode line of Emacs. |
fec3f9a1e3e5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
387
diff
changeset
|
2 |
14734 | 3 ;; Copyright (C) 1985, 86, 87, 93, 94, 1996 Free Software Foundation, Inc. |
841 | 4 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
657
diff
changeset
|
5 ;; Maintainer: FSF |
104 | 6 |
7 ;; This file is part of GNU Emacs. | |
8 | |
9 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
10 ;; it under the terms of the GNU General Public License as published by | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
657
diff
changeset
|
11 ;; the Free Software Foundation; either version 2, or (at your option) |
104 | 12 ;; any later version. |
13 | |
14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;; GNU General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
14169 | 20 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
22 ;; Boston, MA 02111-1307, USA. | |
104 | 23 |
2319
d98c49df2acd
Added or corrected Commentary section
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2293
diff
changeset
|
24 ;;; Commentary: |
d98c49df2acd
Added or corrected Commentary section
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2293
diff
changeset
|
25 |
14169 | 26 ;; Facilities to display current time/date and a new-mail indicator |
27 ;; in the Emacs mode line. The single entry point is `display-time'. | |
2319
d98c49df2acd
Added or corrected Commentary section
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2293
diff
changeset
|
28 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
657
diff
changeset
|
29 ;;; Code: |
104 | 30 |
132
0cbdae7c532f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
104
diff
changeset
|
31 (defvar display-time-mail-file nil |
0cbdae7c532f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
104
diff
changeset
|
32 "*File name of mail inbox file, for indicating existence of new mail. |
9581
a035cc3716a1
(display-time-filter): Ignore mail-spool-file if not string.
Richard M. Stallman <rms@gnu.org>
parents:
8804
diff
changeset
|
33 Non-nil and not a string means don't check for mail. nil means use |
a035cc3716a1
(display-time-filter): Ignore mail-spool-file if not string.
Richard M. Stallman <rms@gnu.org>
parents:
8804
diff
changeset
|
34 default, which is system-dependent, and is the same as used by Rmail.") |
132
0cbdae7c532f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
104
diff
changeset
|
35 |
268 | 36 ;;;###autoload |
3167
e4bcdaa214b1
(display-time-day-and-date): Use defvar, not defconst.
Richard M. Stallman <rms@gnu.org>
parents:
2319
diff
changeset
|
37 (defvar display-time-day-and-date nil "\ |
268 | 38 *Non-nil means \\[display-time] should display day and date as well as time.") |
256 | 39 |
14471
c1154020b9c3
(display-time): Rewrite to use built-in timers.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
40 (defvar display-time-timer nil) |
104 | 41 |
42 (defvar display-time-interval 60 | |
43 "*Seconds between updates of time in the mode line.") | |
44 | |
387 | 45 (defvar display-time-24hr-format nil |
8804
0e668dd3f120
(display-time-24hr-format): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
8459
diff
changeset
|
46 "*Non-nil indicates time should be displayed as hh:mm, 0 <= hh <= 23. |
387 | 47 Nil means 1 <= hh <= 12, and an AM/PM suffix is used.") |
48 | |
104 | 49 (defvar display-time-string nil) |
50 | |
51 (defvar display-time-hook nil | |
52 "* List of functions to be called when the time is updated on the mode line.") | |
53 | |
5463
e277328474cc
(display-time-file-nonempty-p): Check existence here.
Richard M. Stallman <rms@gnu.org>
parents:
4014
diff
changeset
|
54 (defvar display-time-server-down-time nil |
e277328474cc
(display-time-file-nonempty-p): Check existence here.
Richard M. Stallman <rms@gnu.org>
parents:
4014
diff
changeset
|
55 "Time when mail file's file system was recorded to be down. |
e277328474cc
(display-time-file-nonempty-p): Check existence here.
Richard M. Stallman <rms@gnu.org>
parents:
4014
diff
changeset
|
56 If that file system seems to be up, the value is nil.") |
e277328474cc
(display-time-file-nonempty-p): Check existence here.
Richard M. Stallman <rms@gnu.org>
parents:
4014
diff
changeset
|
57 |
256 | 58 ;;;###autoload |
104 | 59 (defun display-time () |
15964
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
60 "Enable display of time, load level, and mail flag in mode lines. |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
61 This display updates automatically every minute. |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
62 If `display-time-day-and-date' is non-nil, the current day and date |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
63 are displayed as well. |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
64 This runs the normal hook `display-time-hook' after each update." |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
65 (interactive) |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
66 (display-time-mode 1)) |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
67 |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
68 ;;;###autoload |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
69 (defun display-time-mode (arg) |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
70 "Toggle display of time, load level, and mail flag in mode lines. |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
71 With a numeric arg, enable this display if arg is positive. |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
72 |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
73 When this display is enabled, it updates automatically every minute. |
104 | 74 If `display-time-day-and-date' is non-nil, the current day and date |
75 are displayed as well. | |
15964
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
76 This runs the normal hook `display-time-hook' after each update." |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
77 (interactive "P") |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
78 (let ((on (if (null arg) |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
79 (not display-time-timer) |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
80 (> (prefix-numeric-value arg) 0)))) |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
81 (and display-time-timer (cancel-timer display-time-timer)) |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
82 (setq display-time-timer nil) |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
83 (setq display-time-string "") |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
84 (or global-mode-string (setq global-mode-string '(""))) |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
85 (if on |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
86 (progn |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
87 (or (memq 'display-time-string global-mode-string) |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
88 (setq global-mode-string |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
89 (append global-mode-string '(display-time-string)))) |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
90 ;; Set up the time timer. |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
91 (setq display-time-timer |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
92 ;; Start timer at the beginning of the next minute. |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
93 (run-at-time (apply 'encode-time 60 (cdr (decode-time))) |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
94 display-time-interval 'display-time-event-handler)) |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
95 ;; Make the time appear right away. |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
96 (display-time-update) |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
97 ;; When you get new mail, clear "Mail" from the mode line. |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
98 (add-hook 'rmail-after-get-new-mail-hook |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
99 'display-time-event-handler)) |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
100 (remove-hook 'rmail-after-get-new-mail-hook |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
101 'display-time-event-handler)))) |
0e6def53a74f
(display-time): Call display-time-mode.
Richard M. Stallman <rms@gnu.org>
parents:
15749
diff
changeset
|
102 |
104 | 103 |
8404
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
104 (defvar display-time-string-forms |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
105 '((if display-time-day-and-date |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
106 (format "%s %s %s " dayname monthname day) |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
107 "") |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
108 (format "%s:%s%s" |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
109 (if display-time-24hr-format 24-hours 12-hours) |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
110 minutes |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
111 (if display-time-24hr-format "" am-pm)) |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
112 load |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
113 (if mail " Mail" "")) |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
114 "*A list of expressions governing display of the time in the mode line. |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
115 This expression is a list of expressions that can involve the keywords |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
116 `load', `day', `month', and `year', `12-hours', `24-hours', `minutes', |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
117 `seconds', all numbers in string form, and `monthname', `dayname', `am-pm', |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
118 and `time-zone' all alphabetic strings, and `mail' a true/nil value. |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
119 |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
120 For example, the form |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
121 |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
122 '((substring year -2) \"/\" month \"/\" day |
10317
dad32dba58bf
(display-time-string-forms): Fix doc string syntax error.
Richard M. Stallman <rms@gnu.org>
parents:
9581
diff
changeset
|
123 \" \" 24-hours \":\" minutes \":\" seconds |
8404
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
124 (if time-zone \" (\") time-zone (if time-zone \")\") |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
125 (if mail \" Mail\" \"\")) |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
126 |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
127 would give mode line times like `94/12/30 21:07:48 (UTC)'.") |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
128 |
14471
c1154020b9c3
(display-time): Rewrite to use built-in timers.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
129 (defun display-time-event-handler () |
14638
46556543f4e6
(display-time-update): New subroutine broken out from
Karl Heuer <kwzh@gnu.org>
parents:
14471
diff
changeset
|
130 (display-time-update) |
46556543f4e6
(display-time-update): New subroutine broken out from
Karl Heuer <kwzh@gnu.org>
parents:
14471
diff
changeset
|
131 ;; Do redisplay right now, if no input pending. |
46556543f4e6
(display-time-update): New subroutine broken out from
Karl Heuer <kwzh@gnu.org>
parents:
14471
diff
changeset
|
132 (sit-for 0)) |
46556543f4e6
(display-time-update): New subroutine broken out from
Karl Heuer <kwzh@gnu.org>
parents:
14471
diff
changeset
|
133 |
46556543f4e6
(display-time-update): New subroutine broken out from
Karl Heuer <kwzh@gnu.org>
parents:
14471
diff
changeset
|
134 ;; Update the display-time info for the mode line |
46556543f4e6
(display-time-update): New subroutine broken out from
Karl Heuer <kwzh@gnu.org>
parents:
14471
diff
changeset
|
135 ;; but don't redisplay right now. This is used for |
46556543f4e6
(display-time-update): New subroutine broken out from
Karl Heuer <kwzh@gnu.org>
parents:
14471
diff
changeset
|
136 ;; things like Rmail `g' that want to force an update |
46556543f4e6
(display-time-update): New subroutine broken out from
Karl Heuer <kwzh@gnu.org>
parents:
14471
diff
changeset
|
137 ;; which can wait for the next redisplay. |
46556543f4e6
(display-time-update): New subroutine broken out from
Karl Heuer <kwzh@gnu.org>
parents:
14471
diff
changeset
|
138 (defun display-time-update () |
12100 | 139 (let* ((now (current-time)) |
140 (time (current-time-string now)) | |
8404
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
141 (load (condition-case () |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
142 (if (zerop (car (load-average))) "" |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
143 (let ((str (format " %03d" (car (load-average))))) |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
144 (concat (substring str 0 -2) "." (substring str -2)))) |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
145 (error ""))) |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
146 (mail-spool-file (or display-time-mail-file |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
147 (getenv "MAIL") |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
148 (concat rmail-spool-directory |
8804
0e668dd3f120
(display-time-24hr-format): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
8459
diff
changeset
|
149 (user-login-name)))) |
9581
a035cc3716a1
(display-time-filter): Ignore mail-spool-file if not string.
Richard M. Stallman <rms@gnu.org>
parents:
8804
diff
changeset
|
150 (mail (and (stringp mail-spool-file) |
a035cc3716a1
(display-time-filter): Ignore mail-spool-file if not string.
Richard M. Stallman <rms@gnu.org>
parents:
8804
diff
changeset
|
151 (or (null display-time-server-down-time) |
8804
0e668dd3f120
(display-time-24hr-format): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
8459
diff
changeset
|
152 ;; If have been down for 20 min, try again. |
0e668dd3f120
(display-time-24hr-format): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
8459
diff
changeset
|
153 (> (- (nth 1 (current-time)) |
0e668dd3f120
(display-time-24hr-format): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
8459
diff
changeset
|
154 display-time-server-down-time) |
0e668dd3f120
(display-time-24hr-format): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
8459
diff
changeset
|
155 1200)) |
0e668dd3f120
(display-time-24hr-format): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
8459
diff
changeset
|
156 (let ((start-time (current-time))) |
0e668dd3f120
(display-time-24hr-format): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
8459
diff
changeset
|
157 (prog1 |
0e668dd3f120
(display-time-24hr-format): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
8459
diff
changeset
|
158 (display-time-file-nonempty-p mail-spool-file) |
0e668dd3f120
(display-time-24hr-format): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
8459
diff
changeset
|
159 (if (> (- (nth 1 (current-time)) (nth 1 start-time)) |
0e668dd3f120
(display-time-24hr-format): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
8459
diff
changeset
|
160 20) |
0e668dd3f120
(display-time-24hr-format): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
8459
diff
changeset
|
161 ;; Record that mail file is not accessible. |
0e668dd3f120
(display-time-24hr-format): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
8459
diff
changeset
|
162 (setq display-time-server-down-time |
0e668dd3f120
(display-time-24hr-format): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
8459
diff
changeset
|
163 (nth 1 (current-time))) |
0e668dd3f120
(display-time-24hr-format): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
8459
diff
changeset
|
164 ;; Record that mail file is accessible. |
0e668dd3f120
(display-time-24hr-format): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
8459
diff
changeset
|
165 (setq display-time-server-down-time nil)))))) |
8404
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
166 (24-hours (substring time 11 13)) |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
167 (hour (string-to-int 24-hours)) |
8804
0e668dd3f120
(display-time-24hr-format): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
8459
diff
changeset
|
168 (12-hours (int-to-string (1+ (% (+ hour 11) 12)))) |
8459
e1a2458245cb
(display-time-filter): pm starts at 12, not 13.
Richard M. Stallman <rms@gnu.org>
parents:
8404
diff
changeset
|
169 (am-pm (if (>= hour 12) "pm" "am")) |
8404
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
170 (minutes (substring time 14 16)) |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
171 (seconds (substring time 17 19)) |
12100 | 172 (time-zone (car (cdr (current-time-zone now)))) |
8404
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
173 (day (substring time 8 10)) |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
174 (year (substring time 20 24)) |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
175 (monthname (substring time 4 7)) |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
176 (month |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
177 (cdr |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
178 (assoc |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
179 monthname |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
180 '(("Jan" . "1") ("Feb" . "2") ("Mar" . "3") ("Apr" . "4") |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
181 ("May" . "5") ("Jun" . "6") ("Jul" . "7") ("Aug" . "8") |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
182 ("Sep" . "9") ("Oct" . "10") ("Nov" . "11") ("Dec" . "12"))))) |
49ffb0b7fd22
(display-time-string-forms): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
183 (dayname (substring time 0 3))) |
104 | 184 (setq display-time-string |
12440
5f4248eb4bdd
(display-time-filter): Move run-hooks inside let.
Richard M. Stallman <rms@gnu.org>
parents:
12100
diff
changeset
|
185 (mapconcat 'eval display-time-string-forms "")) |
5f4248eb4bdd
(display-time-filter): Move run-hooks inside let.
Richard M. Stallman <rms@gnu.org>
parents:
12100
diff
changeset
|
186 ;; This is inside the let binding, but we are not going to document |
5f4248eb4bdd
(display-time-filter): Move run-hooks inside let.
Richard M. Stallman <rms@gnu.org>
parents:
12100
diff
changeset
|
187 ;; what variables are available. |
5f4248eb4bdd
(display-time-filter): Move run-hooks inside let.
Richard M. Stallman <rms@gnu.org>
parents:
12100
diff
changeset
|
188 (run-hooks 'display-time-hook)) |
14638
46556543f4e6
(display-time-update): New subroutine broken out from
Karl Heuer <kwzh@gnu.org>
parents:
14471
diff
changeset
|
189 (force-mode-line-update)) |
256 | 190 |
191 (defun display-time-file-nonempty-p (file) | |
5463
e277328474cc
(display-time-file-nonempty-p): Check existence here.
Richard M. Stallman <rms@gnu.org>
parents:
4014
diff
changeset
|
192 (and (file-exists-p file) |
e277328474cc
(display-time-file-nonempty-p): Check existence here.
Richard M. Stallman <rms@gnu.org>
parents:
4014
diff
changeset
|
193 (< 0 (nth 7 (file-attributes (file-chase-links file)))))) |
657
fec3f9a1e3e5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
387
diff
changeset
|
194 |
fec3f9a1e3e5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
387
diff
changeset
|
195 ;;; time.el ends here |