Mercurial > emacs
annotate lispref/calendar.texi @ 7486:cfe4840ffde9
(Fopen_network_stream): Call bind_polling_period; later unbind the binding.
(POLL_FOR_INPUT): Define, if appropriate.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 13 May 1994 08:31:05 +0000 |
parents | afe506bf7264 |
children | ab6b8aa5002e |
rev | line source |
---|---|
6387 | 1 @c -*-texinfo-*- |
2 @c This is part of the GNU Emacs Lisp Reference Manual. | |
3 @c Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc. | |
4 @c See the file elisp.texi for copying conditions. | |
5 @node Calendar, Tips, Display, Top | |
6 @chapter Customizing the Calendar and Diary | |
7 | |
8 There are many customizations that you can use to make the calendar and | |
9 diary suit your personal tastes. | |
10 | |
11 @menu | |
12 * Calendar Customizing:: Defaults you can set. | |
13 * Holiday Customizing:: Defining your own holidays. | |
14 * Date Display Format:: Changing the format. | |
15 * Time Display Format:: Changing the format. | |
16 * Daylight Savings:: Changing the default. | |
17 * Diary Customizing:: Defaults you can set. | |
18 * Hebrew/Islamic Entries:: How to obtain them. | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
19 * Fancy Diary Display:: Enhancing the diary display, sorting entries, |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
20 using included diary files. |
6387 | 21 * Sexp Diary Entries:: Fancy things you can do. |
22 * Appt Customizing:: Customizing appointment reminders. | |
23 @end menu | |
24 | |
25 @node Calendar Customizing | |
26 @section Customizing the Calendar | |
27 @vindex view-diary-entries-initially | |
28 | |
29 If you set the variable @code{view-diary-entries-initially} to | |
30 @code{t}, calling up the calendar automatically displays the diary | |
31 entries for the current date as well. The diary dates appear only if | |
32 the current date is visible. If you add both of the following lines to | |
33 your @file{.emacs} file:@refill | |
34 | |
35 @example | |
36 (setq view-diary-entries-initially t) | |
37 (calendar) | |
38 @end example | |
39 | |
40 @noindent | |
41 they display both the calendar and diary windows whenever you start Emacs. | |
42 | |
43 @vindex view-calendar-holidays-initially | |
44 Similarly, if you set the variable | |
45 @code{view-calendar-holidays-initially} to @code{t}, entering the | |
46 calendar automatically displays a list of holidays for the current three | |
47 month period. The holiday list appears in a separate window.@refill | |
48 | |
49 @vindex mark-diary-entries-in-calendar | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
50 You can set the variable @code{mark-diary-entries-in-calendar} to |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
51 @code{t} in order to mark any dates with diary entries. This takes |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
52 effect whenever the calendar window contents are recomputed. There are |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
53 two ways of marking these dates: by changing the face (@pxref{Faces}), |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
54 if the display supports that, or by placing a plus sign (@samp{+}) |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
55 beside the date otherwise. |
6387 | 56 |
57 @vindex mark-holidays-in-calendar | |
58 Similarly, setting the variable @code{mark-holidays-in-calendar} to | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
59 @code{t} marks holiday dates, either with a change of face or with an |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
60 asterisk (@samp{*}). |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
61 |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
62 @vindex calendar-holiday-marker |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
63 @vindex diary-entry-marker |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
64 The variable @code{calendar-holiday-marker} specifies how to mark a |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
65 date as being a holiday. Its value may be a character to insert next to |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
66 the date, or a face name to use for displaying the date. Likewise, the |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
67 variable @code{diary-entry-marker} specifies how to mark a date that has |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
68 diary entries. |
6387 | 69 |
70 @vindex calendar-load-hook | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
71 The variable @code{calendar-load-hook} is a normal hook run when the |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
72 calendar package is first loaded (before actually starting to display |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
73 the calendar). |
6387 | 74 |
75 @vindex initial-calendar-window-hook | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
76 Starting the calendar runs the normal hook |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
77 @code{initial-calendar-window-hook}. Recomputation of the calendar |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
78 display does not run this hook. But if you leave the calendar with the |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
79 @kbd{q} command and reenter it, the hook runs again.@refill |
6387 | 80 |
81 @vindex today-visible-calendar-hook | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
82 The variable @code{today-visible-calendar-hook} is a normal hook run |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
83 after the calendar buffer has been prepared with the calendar when the |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
84 current date is visible in the window. One use of this hook is to |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
85 replace today's date with asterisks; to do that, use the hook function |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
86 @code{calendar-star-date}. |
6387 | 87 |
88 @findex calendar-star-date | |
89 @example | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
90 (add-hook 'today-visible-calendar-hook 'calendar-star-date) |
6387 | 91 @end example |
92 | |
93 @noindent | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
94 Another standard hook function marks the current date, either by |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
95 changing its face or by adding an asterisk. Here's how to use it: |
6387 | 96 |
97 @findex calendar-mark-today | |
98 @example | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
99 (add-hook 'today-visible-calendar-hook 'calendar-mark-today) |
6387 | 100 @end example |
101 | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
102 @noindent |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
103 @vindex calendar-today-marker |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
104 The variable @code{calendar-today-marker} specifies how to mark today's |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
105 date. Its value should be a character to insert next to the date or a |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
106 face name to use for displaying the date. |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
107 |
6387 | 108 @vindex today-invisible-calendar-hook |
109 @noindent | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
110 A similar normal hook, @code{today-invisible-calendar-hook} is run if |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
111 the current date is @emph{not} visible in the window. |
6387 | 112 |
113 @node Holiday Customizing | |
114 @section Customizing the Holidays | |
115 | |
116 @vindex calendar-holidays | |
117 @vindex christian-holidays | |
118 @vindex hebrew-holidays | |
119 @vindex islamic-holidays | |
120 Emacs knows about holidays defined by entries on one of several lists. | |
121 You can customize theses lists of holidays to your own needs, adding | |
122 holidays or deleting lists of holidays. The lists of holidays that | |
123 Emacs uses are for general holidays (@code{general-holidays}), local | |
124 holidays (@code{local-holidays}), Christian holidays | |
125 (@code{christian-holidays}), Hebrew (Jewish) holidays | |
126 (@code{hebrew-holidays}), Islamic (Moslem) holidays | |
127 (@code{islamic-holidays}), and other holidays (@code{other-holidays}). | |
128 | |
129 @vindex general-holidays | |
130 The general holidays are, by default, holidays common throughout the | |
131 United States. To eliminate these holidays, set @code{general-holidays} | |
132 to @code{nil}. | |
133 | |
134 @vindex local-holidays | |
135 There are no default local holidays (but sites may supply some). You | |
136 can set the variable @code{local-holidays} to any list of holidays, as | |
137 described below. | |
138 | |
139 @vindex all-christian-calendar-holidays | |
140 @vindex all-hebrew-calendar-holidays | |
141 @vindex all-islamic-calendar-holidays | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
142 By default, Emacs does not include all the holidays of the religions |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
143 that it knows; only those commonly found in secular calendars. For a |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
144 more extensive collection of religious holidays, you can set any (or |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
145 all) of the variables @code{all-christian-calendar-holidays}, |
6387 | 146 @code{all-hebrew-calendar-holidays}, or |
147 @code{all-islamic-calendar-holidays} to @code{t}. If you want to | |
148 eliminate the religious holidays, set any or all of the corresponding | |
149 variables @code{christian-holidays}, @code{hebrew-holidays}, and | |
150 @code{islamic-holidays} to @code{nil}.@refill | |
151 | |
152 @vindex other-holidays | |
153 You can set the variable @code{other-holidays} to any list of | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
154 holidays. This list, normally empty, is intended for individual use. |
6387 | 155 |
156 @cindex holiday forms | |
157 Each of the lists (@code{general-holidays}, @code{local-holidays}, | |
158 @code{christian-holidays}, @code{hebrew-holidays}, | |
159 @code{islamic-holidays}, and @code{other-holidays}) is a list of | |
160 @dfn{holiday forms}, each holiday form describing a holiday (or | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
161 sometimes a list of holidays). |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
162 |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
163 Here is a table of the possible kinds of holiday form. Day numbers |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
164 and month numbers count starting from 1, but day-within-week numbers |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
165 count Sunday as 0. The element @var{string} is always the |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
166 name of the holiday, as a string. |
6387 | 167 |
168 @table @code | |
169 @item (holiday-fixed @var{month} @var{day} @var{string}) | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
170 A fixed date on the Gregorian calendar; @var{month} and |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
171 @var{day} are numbers. |
6387 | 172 |
173 @item (holiday-float @var{month} @var{dayname} @var{k} @var{string}) | |
174 The @var{k}th @var{dayname} in @var{month} on the Gregorian calendar | |
175 (@var{dayname}=0 for Sunday, and so on); negative @var{k} means count back | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
176 from the end of the month. |
6387 | 177 |
178 @item (holiday-hebrew @var{month} @var{day} @var{string}) | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
179 A fixed date on the Hebrew calendar; @var{month} and @var{day} are |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
180 numbers. |
6387 | 181 |
182 @item (holiday-islamic @var{month} @var{day} @var{string}) | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
183 A fixed date on the Islamic calendar; @var{month} and @var{day} are |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
184 numbers. |
6387 | 185 |
186 @item (holiday-julian @var{month} @var{day} @var{string}) | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
187 A fixed date on the Julian calendar; @var{month} and @var{day} are |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
188 numbers. |
6387 | 189 |
190 @item (holiday-sexp @var{sexp} @var{string}) | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
191 A date calculated by the Lisp expression @var{sexp}. The expression |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
192 should use the variable @code{year} to compute the date of a holiday, or |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
193 @code{nil} if the holiday doesn't happen this year. The value of @var{sexp} |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
194 must represent the date as a list of the form @code{(@var{month} @var{day} |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
195 @var{year})}. |
6387 | 196 |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
197 @item (@var{function} @r{[}@var{args}@r{]}) |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
198 A date calculated by the function @var{function}, called with arguments |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
199 @var{args}. |
6387 | 200 @end table |
201 | |
202 For example, suppose you want to add Bastille Day, celebrated in | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
203 France on July 14. You can do this as follows: |
6387 | 204 |
205 @smallexample | |
206 (setq other-holidays '((holiday-fixed 7 14 "Bastille Day"))) | |
207 @end smallexample | |
208 | |
209 @noindent | |
210 The holiday form @code{(holiday-fixed 7 14 "Bastille Day")} specifies the | |
211 fourteenth day of the seventh month (July). | |
212 | |
213 Many holidays occur on a specific day of the week, at a specific time | |
214 of month. Here is a holiday form describing Hurricane Supplication Day, | |
215 celebrated in the Virgin Islands on the fourth Monday in August: | |
216 | |
217 @smallexample | |
218 (holiday-float 8 1 4 "Hurricane Supplication Day") | |
219 @end smallexample | |
220 | |
221 @noindent | |
222 Here the 8 specifies August, the 1 specifies Monday (Sunday is 0, | |
223 Tuesday is 2, and so on), and the 4 specifies the fourth occurrence in | |
224 the month (1 specifies the first occurrence, 2 the second occurrence, | |
225 @minus{}1 the last occurrence, @minus{}2 the second-to-last occurrence, and | |
226 so on). | |
227 | |
228 You can specify holidays that occur on fixed days of the Hebrew, | |
229 Islamic, and Julian calendars too. For example, | |
230 | |
231 @smallexample | |
232 (setq other-holidays | |
233 '((holiday-hebrew 10 2 "Last day of Hanukkah") | |
234 (holiday-islamic 3 12 "Mohammed's Birthday") | |
235 (holiday-julian 4 2 "Jefferson's Birthday"))) | |
236 @end smallexample | |
237 | |
238 @noindent | |
239 adds the last day of Hanukkah (since the Hebrew months are numbered with | |
240 1 starting from Nisan), the Islamic feast celebrating Mohammed's | |
241 birthday (since the Islamic months are numbered from 1 starting with | |
242 Muharram), and Thomas Jefferson's birthday, which is 2 April 1743 on the | |
243 Julian calendar. | |
244 | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
245 To include a holiday conditionally, use either Emacs Lisp's @code{if} or the |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
246 @code{holiday-sexp} form. For example, American presidential elections |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
247 occur on the first Tuesday after the first Monday in November of years |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
248 divisible by 4: |
6387 | 249 |
250 @smallexample | |
251 (holiday-sexp (if (= 0 (% year 4)) | |
252 (calendar-gregorian-from-absolute | |
253 (1+ (calendar-dayname-on-or-before | |
254 1 (+ 6 (calendar-absolute-from-gregorian | |
255 (list 11 1 year)))))) | |
256 "US Presidential Election")) | |
257 @end smallexample | |
258 | |
259 @noindent | |
260 or | |
261 | |
262 @smallexample | |
263 (if (= 0 (% displayed-year 4)) | |
264 (fixed 11 | |
265 (extract-calendar-day | |
266 (calendar-gregorian-from-absolute | |
267 (1+ (calendar-dayname-on-or-before | |
268 1 (+ 6 (calendar-absolute-from-gregorian | |
269 (list 11 1 displayed-year))))))) | |
270 "US Presidential Election")) | |
271 @end smallexample | |
272 | |
273 Some holidays just don't fit into any of these forms because special | |
274 calculations are involved in their determination. In such cases you | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
275 must write a Lisp function to do the calculation. To include eclipses, |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
276 for example, add @code{(eclipses)} to @code{other-holidays} |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
277 and write an Emacs Lisp function @code{eclipses} that returns a |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
278 (possibly empty) list of the relevant Gregorian dates among the range |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
279 visible in the calendar window, with descriptive strings, like this: |
6387 | 280 |
281 @smallexample | |
282 (((6 27 1991) "Lunar Eclipse") ((7 11 1991) "Solar Eclipse") ... ) | |
283 @end smallexample | |
284 | |
285 @node Date Display Format | |
286 @section Date Display Format | |
287 @vindex calendar-date-display-form | |
288 | |
289 You can customize the manner of displaying dates in the diary, | |
290 in mode lines, and in messages by setting | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
291 @code{calendar-date-display-form}. This variable holds a list of |
6387 | 292 expressions that can involve the variables @code{month}, @code{day}, and |
293 @code{year}, all numbers in string form, and @code{monthname} and | |
294 @code{dayname}, both alphabetic strings. In the American style, the | |
295 default value of this list is as follows: | |
296 | |
297 @smallexample | |
298 ((if dayname (concat dayname ", ")) monthname " " day ", " year) | |
299 @end smallexample | |
300 | |
301 @noindent | |
302 while in the European style this value is the default: | |
303 | |
304 @smallexample | |
305 ((if dayname (concat dayname ", ")) day " " monthname " " year) | |
306 @end smallexample | |
307 | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
308 @noindent |
6387 | 309 The ISO standard date representation is this: |
310 | |
311 @smallexample | |
312 (year "-" month "-" day) | |
313 @end smallexample | |
314 | |
315 @noindent | |
316 This specifies a typical American format: | |
317 | |
318 @smallexample | |
319 (month "/" day "/" (substring year -2)) | |
320 @end smallexample | |
321 | |
322 @node Time Display Format | |
323 @section Time Display Format | |
324 @vindex calendar-time-display-form | |
325 | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
326 The calendar and diary by default display times of day in the |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
327 conventional American style with the hours from 1 through 12, minutes, |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
328 and either @samp{am} or @samp{pm}. If you prefer the European style, |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
329 also known in the US as military, in which the hours go from 00 to 23, |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
330 you can alter the variable @code{calendar-time-display-form}. This |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
331 variable is a list of expressions that can involve the variables |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
332 @code{12-hours}, @code{24-hours}, and @code{minutes}, all numbers in |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
333 string form, and @code{am-pm} and @code{time-zone}, both alphabetic |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
334 strings. The default value of @code{calendar-time-display-form} is as |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
335 follows: |
6387 | 336 |
337 @smallexample | |
338 (12-hours ":" minutes am-pm | |
339 (if time-zone " (") time-zone (if time-zone ")")) | |
340 @end smallexample | |
341 | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
342 @noindent |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
343 Here is a value that provides European style times: |
6387 | 344 |
345 @smallexample | |
346 (24-hours ":" minutes | |
347 (if time-zone " (") time-zone (if time-zone ")")) | |
348 @end smallexample | |
349 | |
350 @node Daylight Savings | |
351 @section Daylight Savings Time | |
352 @cindex daylight savings time | |
353 | |
354 Emacs understands the difference between standard time and daylight | |
355 savings time---the times given for sunrise, sunset, solstices, | |
356 equinoxes, and the phases of the moon take that into account. The rules | |
357 for daylight savings time vary from place to place and have also varied | |
358 historically from year to year. To do the job properly, Emacs needs to | |
359 know which rules to use. | |
360 | |
361 Some operating systems keep track of the rules that apply to the place | |
362 where you are; on these systems, Emacs gets the information it needs | |
363 from the system automatically. If some or all of this information is | |
364 missing, Emacs fills in the gaps with the rules currently used in | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
365 Cambridge, Massachusetts, which is the center of GNU's world. If the |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
366 default choice of rules is not appropriate for your location, you can |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
367 tell Emacs the rules to use by setting certain variables. |
6387 | 368 |
369 @vindex calendar-daylight-savings-starts | |
370 @vindex calendar-daylight-savings-ends | |
371 These variables are @code{calendar-daylight-savings-starts} together | |
372 with @code{calendar-daylight-savings-ends}. Their values should be Lisp | |
373 expressions that refer to the variable @code{year}, and evaluate to the | |
374 Gregorian date on which daylight savings time starts or (respectively) | |
375 ends, in the form of a list @code{(@var{month} @var{day} @var{year})}. | |
376 The values should be @code{nil} if your area does not use daylight | |
377 savings time. | |
378 | |
379 Emacs uses these expressions to determine the starting date of | |
380 daylight savings time for the holiday list and for correcting times of | |
381 day in the solar and lunar calculations. | |
382 | |
383 The values for Cambridge, Massachusetts are as follows: | |
384 | |
385 @example | |
386 @group | |
387 (calendar-nth-named-day 1 0 4 year) | |
388 (calendar-nth-named-day -1 0 10 year) | |
389 @end group | |
390 @end example | |
391 | |
392 @noindent | |
393 i.e., the first 0th day (Sunday) of the fourth month (April) in | |
394 the year specified by @code{year}, and the last Sunday of the tenth month | |
395 (October) of that year. If daylight savings time were | |
396 changed to start on October 1, you would set | |
397 @code{calendar-daylight-savings-starts} to this: | |
398 | |
399 @example | |
400 (list 10 1 year) | |
401 @end example | |
402 | |
403 For a more complex example, suppose daylight savings time begins on | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
404 the first of Nisan on the Hebrew calendar. You should set |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
405 @code{calendar-daylight-savings-starts} to this value: |
6387 | 406 |
407 @example | |
408 (calendar-gregorian-from-absolute | |
409 (calendar-absolute-from-hebrew | |
410 (list 1 1 (+ year 3760)))) | |
411 @end example | |
412 | |
413 @noindent | |
414 because Nisan is the first month in the Hebrew calendar and the Hebrew | |
415 year differs from the Gregorian year by 3760 at Nisan. | |
416 | |
417 If there is no daylight savings time at your location, or if you want | |
418 all times in standard time, set @code{calendar-daylight-savings-starts} | |
419 and @code{calendar-daylight-savings-ends} to @code{nil}. | |
420 | |
421 @vindex calendar-daylight-time-offset | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
422 The variable @code{calendar-daylight-time-offset} specifies the |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
423 difference between daylight savings time and standard time, measured in |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
424 minutes. The value for Cambridge is 60. |
6387 | 425 |
426 @vindex calendar-daylight-savings-starts-time | |
427 @vindex calendar-daylight-savings-ends-time | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
428 The variable @code{calendar-daylight-savings-starts-time} and the |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
429 variable @code{calendar-daylight-savings-ends-time} specify the number |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
430 of minutes after midnight local time when the transition to and from |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
431 daylight savings time should occur. For Cambridge, both variables' |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
432 values are 120. |
6387 | 433 |
434 @node Diary Customizing | |
435 @section Customizing the Diary | |
436 | |
437 @vindex holidays-in-diary-buffer | |
438 Ordinarily, the mode line of the diary buffer window indicates any | |
439 holidays that fall on the date of the diary entries. The process of | |
440 checking for holidays can take several seconds, so including holiday | |
441 information delays the display of the diary buffer noticeably. If you'd | |
442 prefer to have a faster display of the diary buffer but without the | |
443 holiday information, set the variable @code{holidays-in-diary-buffer} to | |
444 @code{nil}.@refill | |
445 | |
446 @vindex number-of-diary-entries | |
447 The variable @code{number-of-diary-entries} controls the number of | |
448 days of diary entries to be displayed at one time. It affects the | |
449 initial display when @code{view-diary-entries-initially} is @code{t}, as | |
450 well as the command @kbd{M-x diary}. For example, the default value is | |
451 1, which says to display only the current day's diary entries. If the | |
452 value is 2, both the current day's and the next day's entries are | |
453 displayed. The value can also be a vector of seven elements: if the | |
454 value is @code{[0 2 2 2 2 4 1]} then no diary entries appear on Sunday, | |
455 the current date's and the next day's diary entries appear Monday | |
456 through Thursday, Friday through Monday's entries appear on Friday, | |
457 while on Saturday only that day's entries appear. | |
458 | |
459 @vindex print-diary-entries-hook | |
460 @findex print-diary-entries | |
461 The variable @code{print-diary-entries-hook} is a normal hook run | |
462 after preparation of a temporary buffer containing just the diary | |
463 entries currently visible in the diary buffer. (The other, irrelevant | |
464 diary entries are really absent from the temporary buffer; in the diary | |
465 buffer, they are merely hidden.) The default value of this hook does | |
466 the printing with the command @code{lpr-buffer}. If you want to use a | |
467 different command to do the printing, just change the value of this | |
468 hook. Other uses might include, for example, rearranging the lines into | |
469 order by day and time. | |
470 | |
471 @vindex diary-date-forms | |
472 You can customize the form of dates in your diary file, if neither the | |
473 standard American nor European styles suits your needs, by setting the | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
474 variable @code{diary-date-forms}. This variable is a list of patterns |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
475 for recognizing a date. Each date pattern is a list whose elements may |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
476 be regular expressions (@pxref{Regular Expressions}) or the symbols |
6387 | 477 @code{month}, @code{day}, @code{year}, @code{monthname}, and |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
478 @code{dayname}. All these elements serve as patterns that match certain |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
479 kinds of text in the diary file. In order for the date pattern, as a |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
480 whole, to match, all of its elements must match consecutively. |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
481 |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
482 A regular expression in a date pattern matches in its usual fashion, |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
483 using the standard syntax table altered so that @samp{*} is a word |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
484 constituent. |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
485 |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
486 The symbols @code{month}, @code{day}, @code{year}, @code{monthname}, |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
487 and @code{dayname} match the month number, day number, year number, |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
488 month name, and day name of the date being considered. The symbols that |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
489 match numbers allow leading zeros; those that match names allow |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
490 three-letter abbreviations and capitalization. All the symbols can |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
491 match @samp{*}; since @samp{*} in a diary entry means ``any day'', ``any |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
492 month'', and so on, it should match regardless of the date being |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
493 considered. |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
494 |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
495 The default value of @code{diary-date-forms} in the American style is |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
496 this: |
6387 | 497 |
498 @example | |
499 ((month "/" day "[^/0-9]") | |
500 (month "/" day "/" year "[^0-9]") | |
501 (monthname " *" day "[^,0-9]") | |
502 (monthname " *" day ", *" year "[^0-9]") | |
503 (dayname "\\W")) | |
504 @end example | |
505 | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
506 The date patterns in the list must be @emph{mutually exclusive} and |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
507 must not match any portion of the diary entry itself, just the date and |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
508 one character of whitespace. If, to be mutually exclusive, the pattern |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
509 must match a portion of the diary entry text---beyond the whitespace |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
510 that ends the date---then the first element of the date pattern |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
511 @emph{must} be @code{backup}. This causes the date recognizer to back |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
512 up to the beginning of the current word of the diary entry, after |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
513 finishing the match. Even if you use @code{backup}, the date pattern |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
514 must absolutely not match more than a portion of the first word of the |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
515 diary entry. The default value of @code{diary-date-forms} in the |
6387 | 516 European style is this list: |
517 | |
518 @example | |
519 ((day "/" month "[^/0-9]") | |
520 (day "/" month "/" year "[^0-9]") | |
521 (backup day " *" monthname "\\W+\\<[^*0-9]") | |
522 (day " *" monthname " *" year "[^0-9]") | |
523 (dayname "\\W")) | |
524 @end example | |
525 | |
526 @noindent | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
527 Notice the use of @code{backup} in the third pattern, because it needs |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
528 to match part of a word beyond the date itself to distinguish it from |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
529 the fourth pattern. |
6387 | 530 |
531 @node Hebrew/Islamic Entries | |
532 @section Hebrew- and Islamic-Date Diary Entries | |
533 | |
534 Your diary file can have entries based on Hebrew or Islamic dates, as | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
535 well as entries based on the world-standard Gregorian calendar. |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
536 However, because recognition of such entries is time-consuming and most |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
537 people don't use them, you must explicitly enable their use. If you |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
538 want the diary to recognize Hebrew-date diary entries, for example, |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
539 you must do this: |
6387 | 540 |
541 @vindex nongregorian-diary-listing-hook | |
542 @vindex nongregorian-diary-marking-hook | |
543 @findex list-hebrew-diary-entries | |
544 @findex mark-hebrew-diary-entries | |
545 @smallexample | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
546 (add-hook 'nongregorian-diary-listing-hook 'list-hebrew-diary-entries) |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
547 (add-hook 'nongregorian-diary-marking-hook 'mark-hebrew-diary-entries) |
6387 | 548 @end smallexample |
549 | |
550 @noindent | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
551 If you want Islamic-date entries, do this: |
6387 | 552 |
553 @findex list-islamic-diary-entries | |
554 @findex mark-islamic-diary-entries | |
555 @smallexample | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
556 (add-hook 'nongregorian-diary-listing-hook 'list-islamic-diary-entries) |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
557 (add-hook 'nongregorian-diary-marking-hook 'mark-islamic-diary-entries) |
6387 | 558 @end smallexample |
559 | |
560 Hebrew- and Islamic-date diary entries have the same formats as | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
561 Gregorian-date diary entries, except that @samp{H} precedes a Hebrew |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
562 date and @samp{I} precedes an Islamic date. Moreover, because the |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
563 Hebrew and Islamic month names are not uniquely specified by the first |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
564 three letters, you may not abbreviate them. For example, a diary entry |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
565 for the Hebrew date Heshvan 25 could look like this: |
6387 | 566 |
567 @smallexample | |
568 HHeshvan 25 Happy Hebrew birthday! | |
569 @end smallexample | |
570 | |
571 @noindent | |
572 and would appear in the diary for any date that corresponds to Heshvan 25 | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
573 on the Hebrew calendar. And here is Islamic-date diary entry that matches |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
574 Dhu al-Qada 25: |
6387 | 575 |
576 @smallexample | |
577 IDhu al-Qada 25 Happy Islamic birthday! | |
578 @end smallexample | |
579 | |
580 As with Gregorian-date diary entries, Hebrew- and Islamic-date entries | |
581 are nonmarking if they are preceded with an ampersand (@samp{&}). | |
582 | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
583 Here is a table of commands used in the calendar to create diary entries |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
584 that match the selected date and other dates that are similar in the Hebrew |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
585 or Islamic calendar: |
6387 | 586 |
587 @table @kbd | |
588 @item i h d | |
589 Add a diary entry for the Hebrew date corresponding to the selected date | |
590 (@code{insert-hebrew-diary-entry}). | |
591 @item i h m | |
592 Add a diary entry for the day of the Hebrew month corresponding to the | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
593 selected date (@code{insert-monthly-hebrew-diary-entry}). This diary |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
594 entry matches any date which has the same Hebrew day-within-month as the |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
595 selected date. |
6387 | 596 @item i h y |
597 Add a diary entry for the day of the Hebrew year corresponding to the | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
598 selected date (@code{insert-yearly-hebrew-diary-entry}). This diary |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
599 entry matches any date which has the same Hebrew month and day-within-month |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
600 as the selected date. |
6387 | 601 @item i i d |
602 Add a diary entry for the Islamic date corresponding to the selected date | |
603 (@code{insert-islamic-diary-entry}). | |
604 @item i i m | |
605 Add a diary entry for the day of the Islamic month corresponding to the | |
606 selected date (@code{insert-monthly-islamic-diary-entry}). | |
607 @item i i y | |
608 Add a diary entry for the day of the Islamic year corresponding to the | |
609 selected date (@code{insert-yearly-islamic-diary-entry}). | |
610 @end table | |
611 | |
612 @findex insert-hebrew-diary-entry | |
613 @findex insert-monthly-hebrew-diary-entry | |
614 @findex insert-yearly-hebrew-diary-entry | |
615 @findex insert-islamic-diary-entry | |
616 @findex insert-monthly-islamic-diary-entry | |
617 @findex insert-yearly-islamic-diary-entry | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
618 These commands work much like the corresponding commands for ordinary |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
619 diary entries: they apply to the date that point is on, in the calendar |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
620 window, and what they do is insert just the date portion of a diary entry |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
621 at the end of your diary file. You must then insert the rest of the |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
622 diary entry. |
6387 | 623 |
624 @node Fancy Diary Display | |
625 @section Fancy Diary Display | |
626 @vindex diary-display-hook | |
627 @findex simple-diary-display | |
628 | |
629 Diary display works by preparing the diary buffer and then running the | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
630 hook @code{diary-display-hook}. The default value of this hook |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
631 (@code{simple-diary-display}) hides the irrelevant diary entries and |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
632 then displays the buffer. However, if you specify the hook as follows, |
6387 | 633 |
634 @cindex diary buffer | |
635 @findex fancy-diary-display | |
636 @example | |
637 (add-hook 'diary-display-hook 'fancy-diary-display) | |
638 @end example | |
639 | |
640 @noindent | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
641 this enables fancy diary display. It displays diary entries and |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
642 holidays by copying them into a special buffer that exists only for the |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
643 sake of display. Copying to a separate buffer provides an opportunity |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
644 to change the displayed text to make it prettier---for example, to sort |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
645 the entries by the dates they apply to. |
6387 | 646 |
647 As with simple diary display, you can print a hard copy of the buffer | |
648 with @code{print-diary-entries}. To print a hard copy of a day-by-day | |
649 diary for a week by positioning point on Sunday of that week, type | |
650 @kbd{7 d} and then do @kbd{M-x print-diary-entries}. As usual, the | |
651 inclusion of the holidays slows down the display slightly; you can speed | |
652 things up by setting the variable @code{holidays-in-diary-buffer} to | |
653 @code{nil}. | |
654 | |
655 @vindex diary-list-include-blanks | |
656 Ordinarily, the fancy diary buffer does not show days for which there are | |
657 no diary entries, even if that day is a holiday. If you want such days to be | |
658 shown in the fancy diary buffer, set the variable | |
659 @code{diary-list-include-blanks} to @code{t}.@refill | |
660 | |
661 @cindex sorting diary entries | |
662 If you use the fancy diary display, you can use the normal hook | |
663 @code{list-diary-entries-hook} to sort each day's diary entries by their | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
664 time of day. Here's how |
6387 | 665 |
666 @findex sort-diary-entries | |
667 @example | |
668 (add-hook 'list-diary-entries-hook 'sort-diary-entries) | |
669 @end example | |
670 | |
671 @noindent | |
672 For each day, this sorts diary entries that begin with a recognizable | |
673 time of day according to their times. Diary entries without times come | |
674 first within each day. | |
675 | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
676 Fancy diary display also has the ability to process included diary |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
677 files. This permits a group of people to share a diary file for events |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
678 that apply to all of them. Lines in the diary file of this form: |
6387 | 679 |
680 @smallexample | |
681 #include "@var{filename}" | |
682 @end smallexample | |
683 | |
684 @noindent | |
685 includes the diary entries from the file @var{filename} in the fancy | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
686 diary buffer The include mechanism is recursive, so that included files |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
687 can include other files, and so on; you must be careful not to have a |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
688 cycle of inclusions, of course. Here is how to enable the include |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
689 facility: |
6387 | 690 |
691 @vindex list-diary-entries-hook | |
692 @vindex mark-diary-entries-hook | |
693 @findex include-other-diary-files | |
694 @findex mark-included-diary-files | |
695 @smallexample | |
696 (add-hook 'list-diary-entries-hook 'include-other-diary-files) | |
697 (add-hook 'mark-diary-entries-hook 'mark-included-diary-files) | |
698 @end smallexample | |
699 | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
700 The include mechanism works only with the fancy diary display, because |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
701 ordinary diary display shows the entries directly from your diary file. |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
702 |
6387 | 703 @node Sexp Diary Entries |
704 @section Sexp Entries and the Fancy Diary Display | |
705 @cindex sexp diary entries | |
706 | |
707 Sexp diary entries allow you to do more than just have complicated | |
708 conditions under which a diary entry applies. If you use the fancy | |
709 diary display, sexp entries can generate the text of the entry depending | |
710 on the date itself. For example, an anniversary diary entry can insert | |
711 the number of years since the anniversary date into the text of the | |
712 diary entry. Thus the @samp{%d} in this dairy entry: | |
713 | |
714 @findex diary-anniversary | |
715 @smallexample | |
716 %%(diary-anniversary 10 31 1948) Arthur's birthday (%d years old) | |
717 @end smallexample | |
718 | |
719 @noindent | |
720 gets replaced by the age, so on October 31, 1990 the entry appears in | |
721 the fancy diary buffer like this: | |
722 | |
723 @smallexample | |
724 Arthur's birthday (42 years old) | |
725 @end smallexample | |
726 | |
727 @noindent | |
728 If the diary file instead contains this entry: | |
729 | |
730 @smallexample | |
731 %%(diary-anniversary 10 31 1948) Arthur's %d%s birthday | |
732 @end smallexample | |
733 | |
734 @noindent | |
735 the entry in the fancy diary buffer for October 31, 1990 appears like this: | |
736 | |
737 @smallexample | |
738 Arthur's 42nd birthday | |
739 @end smallexample | |
740 | |
741 Similarly, cyclic diary entries can interpolate the number of repetitions | |
742 that have occurred: | |
743 | |
744 @findex diary-cyclic | |
745 @smallexample | |
746 %%(diary-cyclic 50 1 1 1990) Renew medication (%d%s time) | |
747 @end smallexample | |
748 | |
749 @noindent | |
750 looks like this: | |
751 | |
752 @smallexample | |
753 Renew medication (5th time) | |
754 @end smallexample | |
755 | |
756 @noindent | |
757 in the fancy diary display on September 8, 1990. | |
758 | |
759 The generality of sexp diary entries lets you specify any diary entry | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
760 that you can describe algorithmically. A sexp diary entry contains an |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
761 expression that computes whether the entry applies to any given date. |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
762 If its value is non-@code{nil}, the entry applies to that date; |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
763 otherwise, it does not. The expression can use the variable @code{date} |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
764 to find the date being considered; its value is a list (@var{month} |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
765 @var{day} @var{year}) that refers to the Gregorian calendar. |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
766 |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
767 Suppose you get paid on the 21st of the month if it is a weekday, and |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
768 to the Friday before if the 21st is on a weekend. Here is how to write |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
769 a sexp diary entry that matches those dates: |
6387 | 770 |
771 @smallexample | |
772 &%%(let ((dayname (calendar-day-of-week date)) | |
773 (day (car (cdr date)))) | |
774 (or (and (= day 21) (memq dayname '(1 2 3 4 5))) | |
775 (and (memq day '(19 20)) (= dayname 5))) | |
776 ) Pay check deposited | |
777 @end smallexample | |
778 | |
779 The following sexp diary entries take advantage of the ability (in the fancy | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
780 diary display) to concoct diary entries whose text varies based on the date: |
6387 | 781 |
782 @findex diary-sunrise-sunset | |
783 @findex diary-phases-of-moon | |
784 @findex diary-day-of-year | |
785 @findex diary-iso-date | |
786 @findex diary-julian-date | |
787 @findex diary-astro-day-number | |
788 @findex diary-hebrew-date | |
789 @findex diary-islamic-date | |
790 @findex diary-french-date | |
791 @findex diary-mayan-date | |
792 @table @code | |
793 @item %%(diary-sunrise-sunset) | |
794 Make a diary entry for the local times of today's sunrise and sunset. | |
795 @item %%(diary-phases-of-moon) | |
796 Make a diary entry for the phases (quarters) of the moon. | |
797 @item %%(diary-day-of-year) | |
798 Make a diary entry with today's day number in the current year and the number | |
799 of days remaining in the current year. | |
800 @item %%(diary-iso-date) | |
801 Make a diary entry with today's equivalent ISO commercial date. | |
802 @item %%(diary-julian-date) | |
803 Make a diary entry with today's equivalent date on the Julian calendar. | |
804 @item %%(diary-astro-day-number) | |
805 Make a diary entry with today's equivalent astronomical (Julian) day number. | |
806 @item %%(diary-hebrew-date) | |
807 Make a diary entry with today's equivalent date on the Hebrew calendar. | |
808 @item %%(diary-islamic-date) | |
809 Make a diary entry with today's equivalent date on the Islamic calendar. | |
810 @item %%(diary-french-date) | |
811 Make a diary entry with today's equivalent date on the French Revolutionary | |
812 calendar. | |
813 @item %%(diary-mayan-date) | |
814 Make a diary entry with today's equivalent date on the Mayan calendar. | |
815 @end table | |
816 | |
817 @noindent | |
818 Thus including the diary entry | |
819 | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
820 @example |
6387 | 821 &%%(diary-hebrew-date) |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
822 @end example |
6387 | 823 |
824 @noindent | |
825 causes every day's diary display to contain the equivalent date on the | |
826 Hebrew calendar, if you are using the fancy diary display. (With simple | |
827 diary display, the line @samp{&%%(diary-hebrew-date)} appears in the | |
828 diary for any date, but does nothing particularly useful.) | |
829 | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
830 These functions can be used in sexp diary entries based on the Hebrew |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
831 calendar in certain standard ways: |
6387 | 832 |
833 @cindex rosh hodesh | |
834 @findex diary-rosh-hodesh | |
835 @cindex parasha, weekly | |
836 @findex diary-parasha | |
837 @cindex candle lighting times | |
838 @findex diary-sabbath-candles | |
839 @cindex omer count | |
840 @findex diary-omer | |
841 @cindex yahrzeits | |
842 @findex diary-yahrzeit | |
843 @table @code | |
844 @item %%(diary-rosh-hodesh) | |
845 Make a diary entry that tells the occurrence and ritual announcement of each | |
846 new Hebrew month. | |
847 @item %%(diary-parasha) | |
848 Make a Saturday diary entry that tells the weekly synagogue scripture reading. | |
849 @item %%(diary-sabbath-candles) | |
850 Make a Friday diary entry that tells the @emph{local time} of Sabbath | |
851 candle lighting. | |
852 @item %%(diary-omer) | |
853 Make a diary entry that gives the omer count, when appropriate. | |
854 @item %%(diary-yahrzeit @var{month} @var{day} @var{year}) @var{name} | |
855 Make a diary entry marking the anniversary of a date of death. The date | |
856 is the @emph{Gregorian} (civil) date of death. The diary entry appears | |
857 on the proper Hebrew calendar anniversary and on the day before. (In | |
858 the European style, the order of the parameters is changed to @var{day}, | |
859 @var{month}, @var{year}.) | |
860 @end table | |
861 | |
862 @node Appt Customizing | |
863 @section Customizing Appointment Reminders | |
864 | |
865 You can specify exactly how Emacs reminds you of an appointment and | |
866 how far in advance it begins doing so. Here are the variables that you | |
867 can set: | |
868 | |
869 @vindex appt-message-warning-time | |
870 @vindex appt-audible | |
871 @vindex appt-visible | |
872 @vindex appt-display-mode-line | |
873 @vindex appt-msg-window | |
874 @vindex appt-display-duration | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
875 @vindex appt-disp-window-function |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
876 @vindex appt-delete-window-function |
6387 | 877 @table @code |
878 @item appt-message-warning-time | |
879 The time in minutes before an appointment that the reminder begins. The | |
880 default is 10 minutes. | |
881 @item appt-audible | |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
882 If this is non-@code{nil}, Emacs rings the |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
883 terminal bell for appointment reminders. The default is @code{t}. |
6387 | 884 @item appt-visible |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
885 If this is non-@code{nil}, Emacs displays the appointment |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
886 message in echo area. The default is @code{t}. |
6387 | 887 @item appt-display-mode-line |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
888 If this is non-@code{nil}, Emacs displays the number of minutes |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
889 to the appointment on the mode line. The default is @code{t}. |
6387 | 890 @item appt-msg-window |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
891 If this is non-@code{nil}, Emacs displays the appointment |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
892 message in another window. The default is @code{t}. |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
893 @item appt-disp-window-function |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
894 This variable holds a function to use to create the other window |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
895 for the appointment message. |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
896 @item appt-delete-window-function |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
897 This variable holds a function to use to get rid of the appointment |
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
898 message window, when its time is up. |
6387 | 899 @item appt-display-duration |
7401
afe506bf7264
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6387
diff
changeset
|
900 The number of seconds to display an appointment message. The default |
6387 | 901 is 5 seconds. |
902 @end table |