Mercurial > emacs
annotate lisp/time.el @ 93570:c450cdd35ee3
(latin1-display): Don't use
make-char. Fix the argument to set-char-table-range.
(latin1-display-identities): Don't use make-char.
(latin1-display-reset): Use map-charset-chars instead of directly
calling standard-display-default.
(latin1-display-check-font): Don't use make-char.
(latin1-display-setup): Likewise.
(latin1-display-ucs-per-lynx): Likewise.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 03 Apr 2008 03:51:54 +0000 |
parents | 580893ad3b18 |
children | 1e3a407766b9 |
rev | line source |
---|---|
50395 | 1 ;;; time.el --- display time, load and mail indicator in mode line of Emacs -*-coding: utf-8 -*- |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
2 |
64762
41bb365f41c4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64091
diff
changeset
|
3 ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1996, 2000, 2001, 2002, |
79721 | 4 ;; 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
5 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
6 ;; Maintainer: FSF |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
7 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
8 ;; This file is part of GNU Emacs. |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
9 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
10 ;; GNU Emacs is free software; you can redistribute it and/or modify |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
11 ;; it under the terms of the GNU General Public License as published by |
78236
9355f9b7bbff
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
77721
diff
changeset
|
12 ;; the Free Software Foundation; either version 3, or (at your option) |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
13 ;; any later version. |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
14 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
15 ;; GNU Emacs is distributed in the hope that it will be useful, |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
18 ;; GNU General Public License for more details. |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
19 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
20 ;; You should have received a copy of the GNU General Public License |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64091 | 22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
23 ;; Boston, MA 02110-1301, USA. | |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
24 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
25 ;;; Commentary: |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
26 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
27 ;; Facilities to display current time/date and a new-mail indicator |
82939
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
28 ;; in the Emacs mode line. The entry point is `display-time'. |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
29 |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
30 ;; Display time world in a buffer, the entry point is |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
31 ;; `display-time-world'. |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
32 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
33 ;;; Code: |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
34 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
35 (defgroup display-time nil |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
36 "Display time and load in mode line of Emacs." |
72878
9aa76be5e74c
(display-time): Group mode-line instead of modeline.
Richard M. Stallman <rms@gnu.org>
parents:
68651
diff
changeset
|
37 :group 'mode-line |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
38 :group 'mail) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
39 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
40 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
41 (defcustom display-time-mail-file nil |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
42 "*File name of mail inbox file, for indicating existence of new mail. |
77721
28206c0a5ce2
(display-time-mail-file): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
77715
diff
changeset
|
43 Non-nil and not a string means don't check for mail; nil means use |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
44 default, which is system-dependent, and is the same as used by Rmail." |
47486
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
45 :type '(choice (const :tag "None" none) |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
46 (const :tag "Default" nil) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
47 (file :format "%v")) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
48 :group 'display-time) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
49 |
42998
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
50 (defcustom display-time-mail-directory nil |
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
51 "*Name of mail inbox directory, for indicating existence of new mail. |
45041
cbfb6a5db0be
(display-time-mail-directory, display-time-mail-function): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
42998
diff
changeset
|
52 Any nonempty regular file in the directory is regarded as newly arrived mail. |
cbfb6a5db0be
(display-time-mail-directory, display-time-mail-function): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
42998
diff
changeset
|
53 If nil, do not check a directory for arriving mail." |
42998
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
54 :type '(choice (const :tag "None" nil) |
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
55 (directory :format "%v")) |
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
56 :group 'display-time) |
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
57 |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
58 (defcustom display-time-mail-function nil |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
59 "*Function to call, for indicating existence of new mail. |
45041
cbfb6a5db0be
(display-time-mail-directory, display-time-mail-function): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
42998
diff
changeset
|
60 If nil, that means use the default method: check that the file |
cbfb6a5db0be
(display-time-mail-directory, display-time-mail-function): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
42998
diff
changeset
|
61 specified by `display-time-mail-file' is nonempty or that the |
cbfb6a5db0be
(display-time-mail-directory, display-time-mail-function): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
42998
diff
changeset
|
62 directory `display-time-mail-directory' contains nonempty files." |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
63 :type '(choice (const :tag "Default" nil) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
64 (function)) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
65 :group 'display-time) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
66 |
42261
4f42109edd02
(display-time-load-average-threshold): New variable.
Pavel Janík <Pavel@Janik.cz>
parents:
38759
diff
changeset
|
67 (defcustom display-time-default-load-average 0 |
50395 | 68 "*Which load average value will be shown in the mode line. |
42261
4f42109edd02
(display-time-load-average-threshold): New variable.
Pavel Janík <Pavel@Janik.cz>
parents:
38759
diff
changeset
|
69 Almost every system can provide values of load for past 1 minute, past 5 or |
4f42109edd02
(display-time-load-average-threshold): New variable.
Pavel Janík <Pavel@Janik.cz>
parents:
38759
diff
changeset
|
70 past 15 minutes. The default is to display 1 minute load average." |
4f42109edd02
(display-time-load-average-threshold): New variable.
Pavel Janík <Pavel@Janik.cz>
parents:
38759
diff
changeset
|
71 :type '(choice (const :tag "1 minute load" 0) |
4f42109edd02
(display-time-load-average-threshold): New variable.
Pavel Janík <Pavel@Janik.cz>
parents:
38759
diff
changeset
|
72 (const :tag "5 minutes load" 1) |
47486
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
73 (const :tag "15 minutes load" 2) |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
74 (const :tag "None" nil)) |
42261
4f42109edd02
(display-time-load-average-threshold): New variable.
Pavel Janík <Pavel@Janik.cz>
parents:
38759
diff
changeset
|
75 :group 'display-time) |
4f42109edd02
(display-time-load-average-threshold): New variable.
Pavel Janík <Pavel@Janik.cz>
parents:
38759
diff
changeset
|
76 |
47486
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
77 (defvar display-time-load-average nil |
50395 | 78 "Load average currently being shown in mode line.") |
42261
4f42109edd02
(display-time-load-average-threshold): New variable.
Pavel Janík <Pavel@Janik.cz>
parents:
38759
diff
changeset
|
79 |
4f42109edd02
(display-time-load-average-threshold): New variable.
Pavel Janík <Pavel@Janik.cz>
parents:
38759
diff
changeset
|
80 (defcustom display-time-load-average-threshold 0.1 |
42494
35eeafd85667
(display-time-load-average-threshold): Fix defcustom (add type and group).
Pavel Janík <Pavel@Janik.cz>
parents:
42261
diff
changeset
|
81 "*Load-average values below this value won't be shown in the mode line." |
35eeafd85667
(display-time-load-average-threshold): Fix defcustom (add type and group).
Pavel Janík <Pavel@Janik.cz>
parents:
42261
diff
changeset
|
82 :type 'number |
35eeafd85667
(display-time-load-average-threshold): Fix defcustom (add type and group).
Pavel Janík <Pavel@Janik.cz>
parents:
42261
diff
changeset
|
83 :group 'display-time) |
42261
4f42109edd02
(display-time-load-average-threshold): New variable.
Pavel Janík <Pavel@Janik.cz>
parents:
38759
diff
changeset
|
84 |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
85 ;;;###autoload |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
86 (defcustom display-time-day-and-date nil "\ |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
87 *Non-nil means \\[display-time] should display day and date as well as time." |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
88 :type 'boolean |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
89 :group 'display-time) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
90 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
91 (defvar display-time-timer nil) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
92 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
93 (defcustom display-time-interval 60 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
94 "*Seconds between updates of time in the mode line." |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
95 :type 'integer |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
96 :group 'display-time) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
97 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
98 (defcustom display-time-24hr-format nil |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
99 "*Non-nil indicates time should be displayed as hh:mm, 0 <= hh <= 23. |
77715
5ccb0e885118
(display-time-24hr-format): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
75347
diff
changeset
|
100 A value of nil means 1 <= hh <= 12, and an AM/PM suffix is used." |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
101 :type 'boolean |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
102 :group 'display-time) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
103 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
104 (defvar display-time-string nil) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
105 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
106 (defcustom display-time-hook nil |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
107 "*List of functions to be called when the time is updated on the mode line." |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
108 :type 'hook |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
109 :group 'display-time) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
110 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
111 (defvar display-time-server-down-time nil |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
112 "Time when mail file's file system was recorded to be down. |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
113 If that file system seems to be up, the value is nil.") |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
114 |
85689
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
115 (defcustom zoneinfo-style-world-list |
82939
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
116 '(("America/Los_Angeles" "Seattle") |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
117 ("America/New_York" "New York") |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
118 ("Europe/London" "London") |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
119 ("Europe/Paris" "Paris") |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
120 ("Asia/Calcutta" "Bangalore") |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
121 ("Asia/Tokyo" "Tokyo")) |
85689
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
122 "Alist of zoneinfo-style time zones and places for `display-time-world'. |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
123 Each element has the form (TIMEZONE LABEL). |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
124 TIMEZONE should be a string of the form AREA/LOCATION, where AREA is |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
125 the name of a region -- a continent or ocean, and LOCATION is the name |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
126 of a specific location, e.g., a city, within that region. |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
127 LABEL is a string to display as the label of that TIMEZONE's time." |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
128 :group 'display-time |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
129 :type '(repeat (list string string)) |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
130 :version "23.1") |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
131 |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
132 (defcustom legacy-style-world-list |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
133 '(("PST8PDT" "Seattle") |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
134 ("EST5EDT" "New York") |
85696
93072a4b7046
(legacy-style-world-list): Fix TZ values for London, Bangalore, and Tokyo.
Eli Zaretskii <eliz@gnu.org>
parents:
85689
diff
changeset
|
135 ("GMT0BST" "London") |
85689
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
136 ("CET-1CDT" "Paris") |
85696
93072a4b7046
(legacy-style-world-list): Fix TZ values for London, Bangalore, and Tokyo.
Eli Zaretskii <eliz@gnu.org>
parents:
85689
diff
changeset
|
137 ("IST-5:30" "Bangalore") |
93072a4b7046
(legacy-style-world-list): Fix TZ values for London, Bangalore, and Tokyo.
Eli Zaretskii <eliz@gnu.org>
parents:
85689
diff
changeset
|
138 ("JST-9" "Tokyo")) |
85689
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
139 "Alist of traditional-style time zones and places for `display-time-world'. |
82939
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
140 Each element has the form (TIMEZONE LABEL). |
85689
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
141 TIMEZONE should be a string of the form: |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
142 |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
143 std[+|-]offset[dst[offset][,date[/time],date[/time]]] |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
144 |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
145 See the documentation of the TZ environment variable on your system, |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
146 for more details about the format of TIMEZONE. |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
147 LABEL is a string to display as the label of that TIMEZONE's time." |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
148 :group 'display-time |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
149 :type '(repeat (list string string)) |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
150 :version "23.1") |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
151 |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
152 (defcustom display-time-world-list |
85803
05d1905f2a7a
(display-time-world-list): Test for zoneinfo support.
Jason Rumney <jasonr@gnu.org>
parents:
85696
diff
changeset
|
153 ;; Determine if zoneinfo style timezones are supported by testing that |
05d1905f2a7a
(display-time-world-list): Test for zoneinfo support.
Jason Rumney <jasonr@gnu.org>
parents:
85696
diff
changeset
|
154 ;; America/New York and Europe/London return different timezones. |
05d1905f2a7a
(display-time-world-list): Test for zoneinfo support.
Jason Rumney <jasonr@gnu.org>
parents:
85696
diff
changeset
|
155 (let (gmt nyt) |
05d1905f2a7a
(display-time-world-list): Test for zoneinfo support.
Jason Rumney <jasonr@gnu.org>
parents:
85696
diff
changeset
|
156 (set-time-zone-rule "America/New York") |
05d1905f2a7a
(display-time-world-list): Test for zoneinfo support.
Jason Rumney <jasonr@gnu.org>
parents:
85696
diff
changeset
|
157 (setq nyt (format-time-string "%z")) |
05d1905f2a7a
(display-time-world-list): Test for zoneinfo support.
Jason Rumney <jasonr@gnu.org>
parents:
85696
diff
changeset
|
158 (set-time-zone-rule "Europe/London") |
05d1905f2a7a
(display-time-world-list): Test for zoneinfo support.
Jason Rumney <jasonr@gnu.org>
parents:
85696
diff
changeset
|
159 (setq gmt (format-time-string "%z")) |
05d1905f2a7a
(display-time-world-list): Test for zoneinfo support.
Jason Rumney <jasonr@gnu.org>
parents:
85696
diff
changeset
|
160 (set-time-zone-rule nil) |
05d1905f2a7a
(display-time-world-list): Test for zoneinfo support.
Jason Rumney <jasonr@gnu.org>
parents:
85696
diff
changeset
|
161 (if (string-equal nyt gmt) |
05d1905f2a7a
(display-time-world-list): Test for zoneinfo support.
Jason Rumney <jasonr@gnu.org>
parents:
85696
diff
changeset
|
162 legacy-style-world-list |
05d1905f2a7a
(display-time-world-list): Test for zoneinfo support.
Jason Rumney <jasonr@gnu.org>
parents:
85696
diff
changeset
|
163 zoneinfo-style-world-list)) |
85689
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
164 "Alist of time zones and places for `display-time-world' to display. |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
165 Each element has the form (TIMEZONE LABEL). |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
166 TIMEZONE should be in the format supported by `set-time-zone-rule' on |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
167 your system. See the documentation of `zoneinfo-style-world-list' and |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
168 \`legacy-style-world-list' for two widely used formats. |
f72f7930bbb5
(zoneinfo-style-world-list, legacy-style-world-list): New defcustoms.
Eli Zaretskii <eliz@gnu.org>
parents:
85425
diff
changeset
|
169 LABEL is a string to display as the label of that TIMEZONE's time." |
82939
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
170 :group 'display-time |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
171 :type '(repeat (list string string)) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
172 :version "23.1") |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
173 |
85425
e7618e76351a
(display-time-world-time-format): Display day # not month #.
Richard M. Stallman <rms@gnu.org>
parents:
82939
diff
changeset
|
174 (defcustom display-time-world-time-format "%A %d %B %R %Z" |
82939
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
175 "Format of the time displayed, see `format-time-string'." |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
176 :group 'display-time |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
177 :type 'string |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
178 :version "23.1") |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
179 |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
180 (defcustom display-time-world-buffer-name "*wclock*" |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
181 "Name of the wclock buffer." |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
182 :group 'display-time |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
183 :type 'string |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
184 :version "23.1") |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
185 |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
186 (defcustom display-time-world-timer-enable t |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
187 "If non-nil, a timer will update the world clock." |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
188 :group 'display-time |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
189 :type 'boolean |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
190 :version "23.1") |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
191 |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
192 (defcustom display-time-world-timer-second 60 |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
193 "Interval in seconds for updating the world clock." |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
194 :group 'display-time |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
195 :type 'integer |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
196 :version "23.1") |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
197 |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
198 (defvar display-time-world-mode-map |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
199 (let ((map (make-sparse-keymap))) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
200 (define-key map "q" 'kill-this-buffer) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
201 map) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
202 "Keymap of Display Time World mode") |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
203 |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
204 ;;;###autoload |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
205 (defun display-time () |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
206 "Enable display of time, load level, and mail flag in mode lines. |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
207 This display updates automatically every minute. |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
208 If `display-time-day-and-date' is non-nil, the current day and date |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
209 are displayed as well. |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
210 This runs the normal hook `display-time-hook' after each update." |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
211 (interactive) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
212 (display-time-mode 1)) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
213 |
50395 | 214 ;; This business used to be simpler when all mode lines had the same |
215 ;; face and the image could just be pbm. Now we try to rely on an xpm | |
216 ;; image with a transparent background. Otherwise, set the background | |
217 ;; for pbm. | |
218 | |
219 (defcustom display-time-mail-face nil | |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
220 "Face to use for `display-time-mail-string'. |
50395 | 221 If `display-time-use-mail-icon' is non-nil, the image's |
63261
fbdbc34f3665
(display-time-mail-face): Fix spellings in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
62778
diff
changeset
|
222 background color is the background of this face. Set this to |
fbdbc34f3665
(display-time-mail-face): Fix spellings in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
62778
diff
changeset
|
223 make the mail indicator stand out on a color display." |
68217
7fad4c175274
(display-time-mail-face): Replace :group `faces' with `mode-line-faces'.
Juri Linkov <juri@jurta.org>
parents:
64903
diff
changeset
|
224 :group 'mode-line-faces |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
225 :group 'display-time |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
54525
diff
changeset
|
226 :version "22.1" |
50395 | 227 :type '(choice (const :tag "None" nil) face)) |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
228 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
229 (defvar display-time-mail-icon |
42998
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
230 (find-image '((:type xpm :file "letter.xpm" :ascent center) |
50395 | 231 (:type pbm :file "letter.pbm" :ascent center))) |
232 "Image specification to offer as the mail indicator on a graphic display. | |
233 See `display-time-use-mail-icon' and `display-time-mail-face'.") | |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
234 |
50395 | 235 ;; Fixme: Default to icon on graphical display? |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
236 (defcustom display-time-use-mail-icon nil |
64903
7d23835637c8
(display-time-use-mail-icon, display-time-format)
Luc Teirlinck <teirllm@auburn.edu>
parents:
64762
diff
changeset
|
237 "Non-nil means use an icon as mail indicator on a graphic display. |
50395 | 238 Otherwise use `display-time-mail-string'. The icon may consume less |
239 of the mode line. It is specified by `display-time-mail-icon'." | |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
240 :group 'display-time |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
241 :type 'boolean) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
242 |
50395 | 243 ;; Fixme: maybe default to the character if we can display Unicode. |
244 (defcustom display-time-mail-string "Mail" | |
245 "String to use as the mail indicator in `display-time-string-forms'. | |
246 This can use the Unicode letter character if you can display it." | |
247 :group 'display-time | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
54525
diff
changeset
|
248 :version "22.1" |
50395 | 249 :type '(choice (const "Mail") |
250 ;; Use :tag here because the Lucid menu won't display | |
251 ;; multibyte text. | |
252 (const :tag "Unicode letter character" "✉") | |
253 string)) | |
254 | |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
255 (defcustom display-time-format nil |
64903
7d23835637c8
(display-time-use-mail-icon, display-time-format)
Luc Teirlinck <teirllm@auburn.edu>
parents:
64762
diff
changeset
|
256 "*String specifying format for displaying the time in the mode line. |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
257 See the function `format-time-string' for an explanation of |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
258 how to write this string. If this is nil, the defaults |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
259 depend on `display-time-day-and-date' and `display-time-24hr-format'." |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
260 :type '(choice (const :tag "Default" nil) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
261 string) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
262 :group 'display-time) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
263 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
264 (defcustom display-time-string-forms |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
265 '((if (and (not display-time-format) display-time-day-and-date) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
266 (format-time-string "%a %b %e " now) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
267 "") |
54434
de3c77f25914
(display-time-string-forms): Add help-echo with date on time.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
268 (propertize |
de3c77f25914
(display-time-string-forms): Add help-echo with date on time.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
269 (format-time-string (or display-time-format |
de3c77f25914
(display-time-string-forms): Add help-echo with date on time.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
270 (if display-time-24hr-format "%H:%M" "%-I:%M%p")) |
de3c77f25914
(display-time-string-forms): Add help-echo with date on time.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
271 now) |
54525
b928269daf24
(display-time-string-forms): Fix help-echo date format.
Juri Linkov <juri@jurta.org>
parents:
54434
diff
changeset
|
272 'help-echo (format-time-string "%a %b %e, %Y" now)) |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
273 load |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
274 (if mail |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
275 ;; Build the string every time to act on customization. |
50395 | 276 ;; :set-after doesn't help for `customize-option'. I think it |
277 ;; should. | |
278 (concat | |
279 " " | |
280 (propertize | |
281 display-time-mail-string | |
282 'display `(when (and display-time-use-mail-icon | |
283 (display-graphic-p)) | |
284 ,@display-time-mail-icon | |
285 ,@(if (and display-time-mail-face | |
286 (memq (plist-get (cdr display-time-mail-icon) | |
287 :type) | |
288 '(pbm xbm))) | |
289 (let ((bg (face-attribute display-time-mail-face | |
290 :background))) | |
291 (if (stringp bg) | |
292 (list :background bg))))) | |
293 'face display-time-mail-face | |
294 'help-echo "You have new mail; mouse-2: Read mail" | |
62778
75fa29e46766
(display-time-string-forms, display-time-update):
Luc Teirlinck <teirllm@auburn.edu>
parents:
62402
diff
changeset
|
295 'mouse-face 'mode-line-highlight |
50395 | 296 'local-map (make-mode-line-mouse-map 'mouse-2 |
297 read-mail-command))) | |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
298 "")) |
64903
7d23835637c8
(display-time-use-mail-icon, display-time-format)
Luc Teirlinck <teirllm@auburn.edu>
parents:
64762
diff
changeset
|
299 "*List of expressions governing display of the time in the mode line. |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
300 For most purposes, you can control the time format using `display-time-format' |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
301 which is a more standard interface. |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
302 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
303 This expression is a list of expressions that can involve the keywords |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
304 `load', `day', `month', and `year', `12-hours', `24-hours', `minutes', |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
305 `seconds', all numbers in string form, and `monthname', `dayname', `am-pm', |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
306 and `time-zone' all alphabetic strings, and `mail' a true/nil value. |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
307 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
308 For example, the form |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
309 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
310 '((substring year -2) \"/\" month \"/\" day |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
311 \" \" 24-hours \":\" minutes \":\" seconds |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
312 (if time-zone \" (\") time-zone (if time-zone \")\") |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
313 (if mail \" Mail\" \"\")) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
314 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
315 would give mode line times like `94/12/30 21:07:48 (UTC)'." |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
316 :type 'sexp |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
317 :group 'display-time) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
318 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
319 (defun display-time-event-handler () |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
320 (display-time-update) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
321 ;; Do redisplay right now, if no input pending. |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
322 (sit-for 0) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
323 (let* ((current (current-time)) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
324 (timer display-time-timer) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
325 ;; Compute the time when this timer will run again, next. |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
326 (next-time (timer-relative-time |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
327 (list (aref timer 1) (aref timer 2) (aref timer 3)) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
328 (* 5 (aref timer 4)) 0))) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
329 ;; If the activation time is far in the past, |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
330 ;; skip executions until we reach a time in the future. |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
331 ;; This avoids a long pause if Emacs has been suspended for hours. |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
332 (or (> (nth 0 next-time) (nth 0 current)) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
333 (and (= (nth 0 next-time) (nth 0 current)) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
334 (> (nth 1 next-time) (nth 1 current))) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
335 (and (= (nth 0 next-time) (nth 0 current)) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
336 (= (nth 1 next-time) (nth 1 current)) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
337 (> (nth 2 next-time) (nth 2 current))) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
338 (progn |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
339 (timer-set-time timer (timer-next-integral-multiple-of-time |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
340 current display-time-interval) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
341 display-time-interval) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
342 (timer-activate timer))))) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
343 |
42261
4f42109edd02
(display-time-load-average-threshold): New variable.
Pavel Janík <Pavel@Janik.cz>
parents:
38759
diff
changeset
|
344 (defun display-time-next-load-average () |
4f42109edd02
(display-time-load-average-threshold): New variable.
Pavel Janík <Pavel@Janik.cz>
parents:
38759
diff
changeset
|
345 (interactive) |
4f42109edd02
(display-time-load-average-threshold): New variable.
Pavel Janík <Pavel@Janik.cz>
parents:
38759
diff
changeset
|
346 (if (= 3 (setq display-time-load-average (1+ display-time-load-average))) |
4f42109edd02
(display-time-load-average-threshold): New variable.
Pavel Janík <Pavel@Janik.cz>
parents:
38759
diff
changeset
|
347 (setq display-time-load-average 0)) |
4f42109edd02
(display-time-load-average-threshold): New variable.
Pavel Janík <Pavel@Janik.cz>
parents:
38759
diff
changeset
|
348 (display-time-update) |
4f42109edd02
(display-time-load-average-threshold): New variable.
Pavel Janík <Pavel@Janik.cz>
parents:
38759
diff
changeset
|
349 (sit-for 0)) |
4f42109edd02
(display-time-load-average-threshold): New variable.
Pavel Janík <Pavel@Janik.cz>
parents:
38759
diff
changeset
|
350 |
42998
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
351 (defun display-time-mail-check-directory () |
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
352 (let ((mail-files (directory-files display-time-mail-directory t)) |
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
353 (size 0)) |
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
354 (while (and mail-files (= size 0)) |
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
355 ;; Count size of regular files only. |
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
356 (setq size (+ size (or (and (file-regular-p (car mail-files)) |
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
357 (nth 7 (file-attributes (car mail-files)))) |
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
358 0))) |
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
359 (setq mail-files (cdr mail-files))) |
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
360 (if (> size 0) |
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
361 size |
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
362 nil))) |
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
363 |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
364 (defun display-time-update () |
50395 | 365 "Update the display-time info for the mode line. |
366 However, don't redisplay right now. | |
367 | |
368 This is used for things like Rmail `g' that want to force an | |
369 update which can wait for the next redisplay." | |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
370 (let* ((now (current-time)) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
371 (time (current-time-string now)) |
47486
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
372 (load (if (null display-time-load-average) |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
373 "" |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
374 (condition-case () |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
375 ;; Do not show values less than |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
376 ;; `display-time-load-average-threshold'. |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
377 (if (> (* display-time-load-average-threshold 100) |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
378 (nth display-time-load-average (load-average))) |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
379 "" |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
380 ;; The load average number is mysterious, so |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
381 ;; provide some help. |
50395 | 382 (let ((str (format " %03d" |
383 (nth display-time-load-average | |
384 (load-average))))) | |
47486
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
385 (propertize |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
386 (concat (substring str 0 -2) "." (substring str -2)) |
50395 | 387 'local-map (make-mode-line-mouse-map |
388 'mouse-2 'display-time-next-load-average) | |
62778
75fa29e46766
(display-time-string-forms, display-time-update):
Luc Teirlinck <teirllm@auburn.edu>
parents:
62402
diff
changeset
|
389 'mouse-face 'mode-line-highlight |
50395 | 390 'help-echo (concat |
391 "System load average for past " | |
392 (if (= 0 display-time-load-average) | |
393 "1 minute" | |
394 (if (= 1 display-time-load-average) | |
395 "5 minutes" | |
396 "15 minutes")) | |
397 "; mouse-2: next")))) | |
47486
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
398 (error "")))) |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
399 (mail-spool-file (or display-time-mail-file |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
400 (getenv "MAIL") |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
401 (concat rmail-spool-directory |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
402 (user-login-name)))) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
403 (mail (or (and display-time-mail-function |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
404 (funcall display-time-mail-function)) |
42998
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
405 (and display-time-mail-directory |
144c91651228
(display-time-mail-directory): New option.
Pavel Janík <Pavel@Janik.cz>
parents:
42838
diff
changeset
|
406 (display-time-mail-check-directory)) |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
407 (and (stringp mail-spool-file) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
408 (or (null display-time-server-down-time) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
409 ;; If have been down for 20 min, try again. |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
410 (> (- (nth 1 now) display-time-server-down-time) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
411 1200) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
412 (and (< (nth 1 now) display-time-server-down-time) |
50395 | 413 (> (- (nth 1 now) |
414 display-time-server-down-time) | |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
415 -64336))) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
416 (let ((start-time (current-time))) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
417 (prog1 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
418 (display-time-file-nonempty-p mail-spool-file) |
50395 | 419 (if (> (- (nth 1 (current-time)) |
420 (nth 1 start-time)) | |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
421 20) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
422 ;; Record that mail file is not accessible. |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
423 (setq display-time-server-down-time |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
424 (nth 1 (current-time))) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
425 ;; Record that mail file is accessible. |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
426 (setq display-time-server-down-time nil))))))) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
427 (24-hours (substring time 11 13)) |
62402
a7e02ef1e3d6
Replace `string-to-int' by `string-to-number'.
Juanma Barranquero <lekktu@gmail.com>
parents:
59996
diff
changeset
|
428 (hour (string-to-number 24-hours)) |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
429 (12-hours (int-to-string (1+ (% (+ hour 11) 12)))) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
430 (am-pm (if (>= hour 12) "pm" "am")) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
431 (minutes (substring time 14 16)) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
432 (seconds (substring time 17 19)) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
433 (time-zone (car (cdr (current-time-zone now)))) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
434 (day (substring time 8 10)) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
435 (year (substring time 20 24)) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
436 (monthname (substring time 4 7)) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
437 (month |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
438 (cdr |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
439 (assoc |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
440 monthname |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
441 '(("Jan" . "1") ("Feb" . "2") ("Mar" . "3") ("Apr" . "4") |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
442 ("May" . "5") ("Jun" . "6") ("Jul" . "7") ("Aug" . "8") |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
443 ("Sep" . "9") ("Oct" . "10") ("Nov" . "11") ("Dec" . "12"))))) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
444 (dayname (substring time 0 3))) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
445 (setq display-time-string |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
446 (mapconcat 'eval display-time-string-forms "")) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
447 ;; This is inside the let binding, but we are not going to document |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
448 ;; what variables are available. |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
449 (run-hooks 'display-time-hook)) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
450 (force-mode-line-update)) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
451 |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
452 (defun display-time-file-nonempty-p (file) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
453 (and (file-exists-p file) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
454 (< 0 (nth 7 (file-attributes (file-chase-links file)))))) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
455 |
31980
ceb42baae241
(display-time-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29706
diff
changeset
|
456 ;;;###autoload |
ceb42baae241
(display-time-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29706
diff
changeset
|
457 (define-minor-mode display-time-mode |
ceb42baae241
(display-time-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29706
diff
changeset
|
458 "Toggle display of time, load level, and mail flag in mode lines. |
ceb42baae241
(display-time-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29706
diff
changeset
|
459 With a numeric arg, enable this display if arg is positive. |
ceb42baae241
(display-time-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29706
diff
changeset
|
460 |
ceb42baae241
(display-time-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29706
diff
changeset
|
461 When this display is enabled, it updates automatically every minute. |
ceb42baae241
(display-time-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29706
diff
changeset
|
462 If `display-time-day-and-date' is non-nil, the current day and date |
ceb42baae241
(display-time-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29706
diff
changeset
|
463 are displayed as well. |
ceb42baae241
(display-time-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29706
diff
changeset
|
464 This runs the normal hook `display-time-hook' after each update." |
33197
5ddf69eeb2bb
(display-time-mode): Drop unneeded positional args.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31980
diff
changeset
|
465 :global t :group 'display-time |
47486
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
466 (and display-time-timer (cancel-timer display-time-timer)) |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
467 (setq display-time-timer nil) |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
468 (setq display-time-string "") |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
469 (or global-mode-string (setq global-mode-string '(""))) |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
470 (setq display-time-load-average display-time-default-load-average) |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
471 (if display-time-mode |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
472 (progn |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
473 (or (memq 'display-time-string global-mode-string) |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
474 (setq global-mode-string |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
475 (append global-mode-string '(display-time-string)))) |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
476 ;; Set up the time timer. |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
477 (setq display-time-timer |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
478 (run-at-time t display-time-interval |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
479 'display-time-event-handler)) |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
480 ;; Make the time appear right away. |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
481 (display-time-update) |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
482 ;; When you get new mail, clear "Mail" from the mode line. |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
483 (add-hook 'rmail-after-get-new-mail-hook |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
484 'display-time-event-handler)) |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
485 (remove-hook 'rmail-after-get-new-mail-hook |
19084a962da7
(display-time-mode): Set display-time-load-average here.
Richard M. Stallman <rms@gnu.org>
parents:
45041
diff
changeset
|
486 'display-time-event-handler))) |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
487 |
82939
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
488 |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
489 (defun display-time-world-mode () |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
490 "Major mode for buffer that displays times in various time zones. |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
491 See `display-time-world'." |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
492 (interactive) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
493 (kill-all-local-variables) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
494 (setq |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
495 major-mode 'display-time-world-mode |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
496 mode-name "World clock") |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
497 (use-local-map display-time-world-mode-map)) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
498 |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
499 (defun display-time-world-display (alist) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
500 "Replace current buffer text with times in various zones, based on ALIST." |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
501 (let ((inhibit-read-only t) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
502 (buffer-undo-list t)) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
503 (erase-buffer) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
504 (let ((max-width 0) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
505 (result ())) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
506 (unwind-protect |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
507 (dolist (zone alist) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
508 (let* ((label (cadr zone)) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
509 (width (string-width label))) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
510 (set-time-zone-rule (car zone)) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
511 (setq result |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
512 (append result |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
513 (list |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
514 label width |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
515 (format-time-string display-time-world-time-format)))) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
516 (when (> width max-width) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
517 (setq max-width width)))) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
518 (set-time-zone-rule nil)) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
519 (while result |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
520 (insert (pop result) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
521 (make-string (1+ (- max-width (pop result))) ?\s) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
522 (pop result) "\n"))) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
523 (delete-backward-char 1))) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
524 |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
525 ;;;###autoload |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
526 (defun display-time-world () |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
527 "Enable updating display of times in various time zones. |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
528 `display-time-world-list' specifies the zones. |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
529 To turn off the world time display, go to that window and type `q'." |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
530 (interactive) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
531 (when (and display-time-world-timer-enable |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
532 (not (get-buffer display-time-world-buffer-name))) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
533 (run-at-time t display-time-world-timer-second 'display-time-world-timer)) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
534 (with-current-buffer (get-buffer-create display-time-world-buffer-name) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
535 (display-time-world-display display-time-world-list)) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
536 (pop-to-buffer display-time-world-buffer-name) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
537 (fit-window-to-buffer) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
538 (display-time-world-mode)) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
539 |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
540 (defun display-time-world-timer () |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
541 (if (get-buffer display-time-world-buffer-name) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
542 (with-current-buffer (get-buffer display-time-world-buffer-name) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
543 (display-time-world-display display-time-world-list)) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
544 ;; cancel timer |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
545 (let ((list timer-list)) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
546 (while list |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
547 (let ((elt (pop list))) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
548 (when (equal (symbol-name (aref elt 5)) "display-time-world-timer") |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
549 (cancel-timer elt))))))) |
f1ad11ae7c01
New feature to display several time zones in a buffer.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
550 |
91862
af26df6df4a9
(emacs-uptime): Move here from time-date.el.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
551 ;;;###autoload |
91864
c4522ed32e3a
(emacs-uptime): Add optional `format' argument. Doc fix. Use `%z'
Glenn Morris <rgm@gnu.org>
parents:
91862
diff
changeset
|
552 (defun emacs-uptime (&optional format) |
c4522ed32e3a
(emacs-uptime): Add optional `format' argument. Doc fix. Use `%z'
Glenn Morris <rgm@gnu.org>
parents:
91862
diff
changeset
|
553 "Return a string giving the uptime of this instance of Emacs. |
c4522ed32e3a
(emacs-uptime): Add optional `format' argument. Doc fix. Use `%z'
Glenn Morris <rgm@gnu.org>
parents:
91862
diff
changeset
|
554 FORMAT is a string to format the result, using `format-seconds'. |
c4522ed32e3a
(emacs-uptime): Add optional `format' argument. Doc fix. Use `%z'
Glenn Morris <rgm@gnu.org>
parents:
91862
diff
changeset
|
555 For example, the Unix uptime command format is \"%D, %z%2h:%.2m\"." |
91862
af26df6df4a9
(emacs-uptime): Move here from time-date.el.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
556 (interactive) |
af26df6df4a9
(emacs-uptime): Move here from time-date.el.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
557 (let ((str |
91864
c4522ed32e3a
(emacs-uptime): Add optional `format' argument. Doc fix. Use `%z'
Glenn Morris <rgm@gnu.org>
parents:
91862
diff
changeset
|
558 (format-seconds (or format "%Y, %D, %H, %M, %z%S") |
91862
af26df6df4a9
(emacs-uptime): Move here from time-date.el.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
559 (time-to-seconds |
91884
927a69bb381a
(emacs-uptime): Use before-init-time rather than emacs-startup-time.
Glenn Morris <rgm@gnu.org>
parents:
91864
diff
changeset
|
560 (time-subtract (current-time) before-init-time))))) |
91862
af26df6df4a9
(emacs-uptime): Move here from time-date.el.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
561 (if (interactive-p) |
af26df6df4a9
(emacs-uptime): Move here from time-date.el.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
562 (message "%s" str) |
af26df6df4a9
(emacs-uptime): Move here from time-date.el.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
563 str))) |
af26df6df4a9
(emacs-uptime): Move here from time-date.el.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
564 |
91894
8172ec5d2dd0
(emacs-init-time): New function.
Juri Linkov <juri@jurta.org>
parents:
91884
diff
changeset
|
565 ;;;###autoload |
8172ec5d2dd0
(emacs-init-time): New function.
Juri Linkov <juri@jurta.org>
parents:
91884
diff
changeset
|
566 (defun emacs-init-time () |
8172ec5d2dd0
(emacs-init-time): New function.
Juri Linkov <juri@jurta.org>
parents:
91884
diff
changeset
|
567 "Return a string giving the duration of the Emacs initialization." |
8172ec5d2dd0
(emacs-init-time): New function.
Juri Linkov <juri@jurta.org>
parents:
91884
diff
changeset
|
568 (interactive) |
8172ec5d2dd0
(emacs-init-time): New function.
Juri Linkov <juri@jurta.org>
parents:
91884
diff
changeset
|
569 (let ((str |
91916
37418cd19627
(emacs-init-time): Use format instead of format-seconds.
Juri Linkov <juri@jurta.org>
parents:
91894
diff
changeset
|
570 (format "%.1f seconds" |
37418cd19627
(emacs-init-time): Use format instead of format-seconds.
Juri Linkov <juri@jurta.org>
parents:
91894
diff
changeset
|
571 (time-to-seconds |
37418cd19627
(emacs-init-time): Use format instead of format-seconds.
Juri Linkov <juri@jurta.org>
parents:
91894
diff
changeset
|
572 (time-subtract after-init-time before-init-time))))) |
91894
8172ec5d2dd0
(emacs-init-time): New function.
Juri Linkov <juri@jurta.org>
parents:
91884
diff
changeset
|
573 (if (interactive-p) |
8172ec5d2dd0
(emacs-init-time): New function.
Juri Linkov <juri@jurta.org>
parents:
91884
diff
changeset
|
574 (message "%s" str) |
8172ec5d2dd0
(emacs-init-time): New function.
Juri Linkov <juri@jurta.org>
parents:
91884
diff
changeset
|
575 str))) |
8172ec5d2dd0
(emacs-init-time): New function.
Juri Linkov <juri@jurta.org>
parents:
91884
diff
changeset
|
576 |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
577 (provide 'time) |
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
578 |
52401 | 579 ;;; arch-tag: b9c1623f-b5cb-48e4-b650-482a4d23c5a6 |
29706
1030e638c8dd
Remove trailing ^M that prevent CVS-merging.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29693
diff
changeset
|
580 ;;; time.el ends here |