0
|
1 @node Calendar/Diary, Sorting, Reading Mail, Top
|
|
2 @section Calendar Mode and the Diary
|
|
3 @cindex calendar
|
|
4 @findex calendar
|
|
5
|
|
6 Emacs provides the functions of a desk calendar, with a diary of past
|
|
7 or planned events. Display the calendar by typing @kbd{M-x calendar}.
|
|
8 This command creates a window containing a three-month calendar centered
|
|
9 on the current month, with point on the current date. Or, provide a
|
|
10 prefix argument by typing @kbd{C-u M-x calendar}; then you are prompted
|
|
11 for the month and year to be the center of the three-month calendar. In
|
|
12 either case, you are now in Calendar mode.
|
|
13
|
|
14 Calendar mode makes it easy to look at the holidays or diary entries
|
|
15 associated with various dates, and to change the diary entries. You can move
|
|
16 freely between the Calendar window and other windows. To exit the calendar,
|
|
17 type @kbd{q}.
|
|
18
|
|
19 @menu
|
|
20 * Calendar Motion:: Moving through the calendar; selecting a date.
|
|
21 * Scroll Calendar:: Bringing earlier or later months onto the screen.
|
|
22 * Mark and Region:: Remembering dates, the mark ring.
|
|
23 * General Calendar:: Conveniences for moving about.
|
|
24 * Holidays:: Displaying dates of holidays.
|
|
25 * Sunrise/Sunset:: Displaying local times of sunrise and sunset.
|
|
26 * Lunar Phases:: Displaying phases of the moon.
|
|
27 * Other Calendars:: Converting dates to other calendar systems.
|
|
28 * Diary:: Displaying events from your diary.
|
|
29 * Calendar Customization:: Altering the behavior of the features above.
|
|
30 @end menu
|
|
31
|
|
32 @node Calendar Motion, Scroll Calendar, Calendar/Diary, Calendar/Diary
|
|
33 @subsection Movement in the Calendar
|
|
34
|
|
35 Calendar mode lets you move in logical units of time such as days,
|
|
36 weeks, months, and years. Sometimes you need to move to a specific date
|
|
37 in order to enter commands affecting its display or the associated diary
|
|
38 entries. If you move outside the three months originally displayed, the
|
|
39 calendar display scrolls automatically through time.
|
|
40
|
|
41 @menu
|
|
42 * Calendar Unit Motion:: Moving by days, weeks, months, and years.
|
|
43 * Move to Beginning or End:: Moving to start/end of weeks, months, and years.
|
|
44 * Specified Dates:: Moving to the current date or another specific date.
|
|
45 @end menu
|
|
46
|
|
47 @node Calendar Unit Motion, Move to Beginning or End, Calendar Motion, Calendar Motion
|
|
48 @subsubsection Motion by Integral Days, Weeks, Months, Years
|
|
49
|
|
50 The commands for movement in the calendar buffer parallel the
|
|
51 commands for movement in text. You can move forward and backward by
|
|
52 days, weeks, months, and years.
|
|
53
|
|
54 @table @kbd
|
|
55 @item C-f
|
|
56 Move point one day forward (@code{calendar-forward-day}).
|
|
57 @item C-b
|
|
58 Move point one day backward (@code{calendar-backward-day}).
|
|
59 @item C-n
|
|
60 Move point one week forward (@code{calendar-forward-week}).
|
|
61 @item C-p
|
|
62 Move point one week backward (@code{calendar-backward-week}).
|
|
63 @item M-@}
|
|
64 Move point one month forward (@code{calendar-forward-month}).
|
|
65 @item M-@{
|
|
66 Move point one month backward (@code{calendar-backward-month}).
|
|
67 @item C-x ]
|
|
68 Move point one year forward (@code{calendar-forward-year}).
|
|
69 @item C-x [
|
|
70 Move point one year backward (@code{calendar-forward-year}).
|
|
71 @end table
|
|
72
|
|
73 @kindex C-f (Calendar mode)
|
|
74 @findex calendar-forward-day
|
|
75 @kindex C-b (Calendar mode)
|
|
76 @findex calendar-backward-day
|
|
77 @kindex C-n (Calendar mode)
|
|
78 @findex calendar-forward-week
|
|
79 @kindex C-p (Calendar mode)
|
|
80 @findex calendar-backward-week
|
|
81 The day and week commands are natural analogues of the usual Emacs
|
|
82 commands for moving by characters and by lines. Just as @kbd{C-n}
|
|
83 usually moves to the same column in the following line, in Calendar
|
|
84 mode it moves to the same day in the following week. And @kbd{C-p}
|
|
85 moves to the same day in the previous week.
|
|
86
|
|
87 @kindex M-@} (Calendar mode)
|
|
88 @findex calendar-forward-month
|
|
89 @kindex M-@{ (Calendar mode)
|
|
90 @findex calendar-backward-month
|
|
91 @kindex C-x ] (Calendar mode)
|
|
92 @findex calendar-forward-year
|
|
93 @kindex C-x [ (Calendar mode)
|
|
94 @findex calendar-forward-year
|
|
95 The commands for motion by months and years work like those for
|
|
96 weeks, but move a larger distance. The month commands @kbd{M-@}} and
|
|
97 @kbd{M-@{} move forward or backward by an entire month's time. The
|
|
98 year commands @kbd{C-x ]} and @kbd{C-x [} move forward or backward a
|
|
99 whole year.
|
|
100
|
|
101 The easiest way to remember these commands is to consider months and
|
|
102 years analogous to paragraphs and pages of text, respectively. But the
|
|
103 commands themselves are not quite analogous. The ordinary Emacs paragraph
|
|
104 commands move to the beginning or end of a paragraph, whereas these month
|
|
105 and year commands move by an entire month or an entire year, which usually
|
|
106 involves skipping across the end of a month or year.
|
|
107
|
|
108 Each of these commands accepts a numeric argument as a repeat count. For
|
|
109 convenience, the digit keys and the minus sign are bound in Calendar mode so
|
|
110 that it is unnecessary to type the @kbd{M-} prefix. For example, @kbd{100
|
|
111 C-f} moves point 100 days forward from its present location.
|
|
112
|
|
113 @node Move to Beginning or End, Specified Dates, Calendar Unit Motion, Calendar Motion
|
|
114 @subsubsection Beginning or End of Week, Month or Year
|
|
115
|
|
116 A week (or month, or year) is not just a quantity of days; we think
|
|
117 of new weeks (months, years) as starting on particular days. So
|
|
118 Calendar mode provides commands to move to the beginning or end of the
|
|
119 week, month or year:
|
|
120
|
|
121 @table @kbd
|
|
122 @kindex C-a (Calendar mode)
|
|
123 @findex calendar-beginning-of-week
|
|
124 @item C-a
|
|
125 Move point to beginning of week (@code{calendar-beginning-of-week}).
|
|
126 @kindex C-e (Calendar mode)
|
|
127 @findex calendar-end-of-week
|
|
128 @item C-e
|
|
129 Move point to end of week (@code{calendar-end-of-week}).
|
|
130 @kindex M-a (Calendar mode)
|
|
131 @findex calendar-beginning-of-month
|
|
132 @item M-a
|
|
133 Move point to beginning of month (@code{calendar-beginning-of-month}).
|
|
134 @kindex M-e (Calendar mode)
|
|
135 @findex calendar-end-of-month
|
|
136 @item M-e
|
|
137 Move point to end of month (@code{calendar-end-of-month}).
|
|
138 @kindex M-< (Calendar mode)
|
|
139 @findex calendar-beginning-of-year
|
|
140 @item M-<
|
|
141 Move point to beginning of year (@code{calendar-beginning-of-year}).
|
|
142 @kindex M-> (Calendar mode)
|
|
143 @findex calendar-end-of-year
|
|
144 @item M->
|
|
145 Move point to end of year (@code{calendar-end-of-year}).
|
|
146 @end table
|
|
147
|
|
148 These commands also take numeric arguments as repeat counts, with the
|
|
149 repeat count indicating how many weeks, months, or years to move
|
|
150 backward or forward.
|
|
151
|
|
152 @node Specified Dates,,Move to Beginning or End, Calendar Motion
|
|
153 @subsubsection Particular Dates
|
|
154
|
|
155 Calendar mode provides some commands for getting to a particular date
|
|
156 quickly.
|
|
157
|
|
158 @table @kbd
|
|
159 @item g d
|
|
160 Move point to specified date (@code{calendar-goto-date}).
|
|
161 @item o
|
|
162 Center calendar around specified month (@code{calendar-other-month}).
|
|
163 @item .
|
|
164 Move point to today's date (@code{calendar-current-month}).
|
|
165 @end table
|
|
166
|
|
167 @kindex g d (Calendar mode)
|
|
168 @findex calendar-goto-date
|
|
169 @kbd{g d} (@code{calendar-goto-date}) prompts for a year, a month, and a day
|
|
170 of the month, and then goes to that date. Because the calendar includes all
|
|
171 dates from the beginning of the current era, you must type the year in its
|
|
172 entirety; that is, type @samp{1990}, not @samp{90}.
|
|
173
|
|
174 @kindex o (Calendar mode)
|
|
175 @findex calendar-other-month
|
|
176 @kbd{o} (@code{calendar-other-month}) prompts for a month and year,
|
|
177 then centers the three-month calendar around that month.
|
|
178
|
|
179 @kindex . (Calendar mode)
|
|
180 @findex calendar-current-month
|
|
181 You can return to the current date with @kbd{.}
|
|
182 (@code{calendar-current-month}).
|
|
183
|
|
184 @node Scroll Calendar, Mark and Region, Calendar Motion, Calendar/Diary
|
|
185 @subsection Scrolling the Calendar through Time
|
|
186
|
|
187 The calendar display scrolls automatically through time when you move out
|
|
188 of the visible portion. You can also scroll it manually. Imagine that the
|
|
189 calendar window contains a long strip of paper with the months on it.
|
|
190 Scrolling it means moving the strip so that new months become visible in
|
|
191 the window.
|
|
192
|
|
193 @table @kbd
|
|
194 @item C-x <
|
|
195 Scroll calendar one month forward (@code{scroll-calendar-left}).
|
|
196 @item C-x >
|
|
197 Scroll calendar one month backward (@code{scroll-calendar-right}).
|
|
198 @item C-v
|
|
199 Scroll calendar three months forward
|
|
200 (@code{scroll-calendar-left-three-months}).
|
|
201 @item M-v
|
|
202 Scroll calendar three months backward
|
|
203 (@code{scroll-calendar-right-three-months}).
|
|
204 @end table
|
|
205
|
|
206 @kindex C-x < (Calendar mode)
|
|
207 @findex scroll-calendar-left
|
|
208 @kindex C-x > (Calendar mode)
|
|
209 @findex scroll-calendar-right
|
|
210 The most basic calendar scroll commands scroll by one month at a
|
|
211 time. This means that there are two months of overlap between the
|
|
212 display before the command and the display after. @kbd{C-x <} scrolls
|
|
213 the calendar contents one month to the left; that is, it moves the
|
|
214 display forward in time. @kbd{C-x >} scrolls the contents to the
|
|
215 right, which moves backwards in time.
|
|
216
|
|
217 @kindex C-v (Calendar mode)
|
|
218 @findex scroll-calendar-left-three-months
|
|
219 @kindex M-v (Calendar mode)
|
|
220 @findex scroll-calendar-right-three-months
|
|
221 The commands @kbd{C-v} and @kbd{M-v} scroll the calendar by an entire
|
|
222 ``screenful''---three months---in analogy with the usual meaning of these
|
|
223 commands. @kbd{C-v} makes later dates visible and @kbd{M-v} makes earlier
|
|
224 dates visible. These commands also take a numeric argument as a repeat
|
|
225 count; in particular, since @kbd{C-u} (@code{universal-argument}) multiplies
|
|
226 the next command by four, typing @kbd{C-u C-v} scrolls the calendar forward by
|
|
227 a year and typing @kbd{C-u M-v} scrolls the calendar backward by a year.
|
|
228
|
|
229 Any of the special Calendar mode commands scrolls the calendar automatically
|
|
230 as necessary to ensure that the date you have moved to is visible.
|
|
231
|
|
232 @node Mark and Region, General Calendar, Scroll Calendar, Calendar/Diary
|
|
233 @subsection The Mark and the Region
|
|
234
|
|
235 The concept of the mark applies to the calendar just as to any other
|
|
236 buffer, but it marks a @emph{date}, not a @emph{position} in the buffer.
|
|
237 The region consists of the days between the mark and point (including
|
|
238 the starting and stopping dates).
|
|
239
|
|
240 @table @kbd
|
|
241 @item C-SPC
|
|
242 Set the mark to today's date (@code{calendar-set-mark}).
|
|
243 @item C-@@
|
|
244 The same.
|
|
245 @item C-x C-x
|
|
246 Interchange mark and point (@code{calendar-exchange-point-and-mark}).
|
|
247 @item M-=
|
|
248 Display the number of days in the current region
|
|
249 (@code{calendar-count-days-region}).
|
|
250 @end table
|
|
251
|
|
252 @kindex C-@@ (Calendar mode)
|
|
253 @kindex C-SPC (Calendar mode)
|
|
254 @findex calendar-set-mark
|
|
255 @kindex C-x C-x (Calendar mode)
|
|
256 @findex calendar-exchange-point-and-mark
|
|
257 You set the mark in the calendar, as in any other buffer, by using @kbd{C-@@}
|
|
258 or @kbd{C-SPC} (@code{calendar-set-mark}). You return to the marked date
|
|
259 with the command @kbd{C-x C-x} (@code{calendar-exchange-point-and-mark})
|
|
260 which puts the mark where point was and point where mark was. The calendar
|
|
261 is scrolled as necessary, if the marked date was not visible on the
|
|
262 screen. This does not change the extent of the region.
|
|
263
|
|
264 @kindex M-= (Calendar mode)
|
|
265 @findex calendar-count-days-region
|
|
266 To determine the number of days in the region, type @kbd{M-=}
|
|
267 (@code{calendar-count-days-region}). The numbers of days printed is
|
|
268 @emph{inclusive}, that is, includes the days specified by mark and point.
|
|
269
|
|
270 @cindex mark ring
|
|
271 The main use of the mark in the calendar is to remember dates that you may
|
|
272 want to go back to. To make this feature more useful, the mark ring
|
|
273 (@pxref{Mark Ring}) operates exactly as in other buffers: Emacs remembers
|
|
274 16 previous locations of the mark. To return to a marked date, type @kbd{C-u
|
|
275 C-SPC} (or @kbd{C-u C-@@}); this is the command @code{calendar-set-mark} given
|
|
276 a numeric argument. It moves point to where the mark was, restores the mark
|
|
277 from the ring of former marks, and stores the previous point at the end of
|
|
278 the mark ring. So, repeated use of this command moves point through all
|
|
279 the old marks on the ring, one by one.
|
|
280
|
|
281 @node General Calendar, Holidays, Mark and Region, Calendar/Diary
|
|
282 @subsection Miscellaneous Calendar Commands
|
|
283
|
|
284 @table @kbd
|
|
285 @item p d
|
|
286 Display day-in-year (@code{calendar-print-day-of-year}).
|
|
287 @item ?
|
|
288 Briefly describe calendar commands (@code{describe-calendar-mode}).
|
|
289 @item SPC
|
|
290 Scroll the next window (@code{scroll-other-window}).
|
|
291 @item C-c C-l
|
|
292 Regenerate the calendar window (@code{redraw-calendar}).
|
|
293 @item q
|
|
294 Exit from calendar (@code{exit-calendar}).
|
|
295 @end table
|
|
296
|
|
297 @kindex p d (Calendar mode)
|
|
298 @cindex day of year
|
|
299 @findex calendar-print-day-of-year
|
|
300 If you want to know how many days have elapsed since the start of
|
|
301 the year, or the number of days remaining in the year, type the @kbd{p d}
|
|
302 command (@code{calendar-print-day-of-year}). This displays both
|
|
303 of those numbers in the echo area.
|
|
304
|
|
305 @kindex ? (Calendar mode)
|
|
306 @findex describe-calendar-mode
|
|
307 To display a brief description of the calendar commands, type @kbd{?}
|
|
308 (@code{describe-calendar-mode}). For a fuller description, type @kbd{C-h m}.
|
|
309
|
|
310 @kindex SPC (Calendar mode)
|
|
311 @findex scroll-other-window
|
|
312 You can use @kbd{SPC} (@code{scroll-other-window}) to scroll the other
|
|
313 window. This is handy when you display a list of holidays or diary entries
|
|
314 in another window.
|
|
315
|
|
316 @kindex C-c C-l (Calendar mode)
|
|
317 @findex redraw-calendar
|
|
318 If the calendar window gets corrupted, type @kbd{C-c C-l}
|
|
319 (@code{redraw-calendar}) to redraw it.
|
|
320
|
|
321 @kindex q (Calendar mode)
|
|
322 @findex exit-calendar
|
|
323 To exit from the calendar, type @kbd{q} (@code{exit-calendar}). This
|
|
324 buries all buffers related to the calendar and returns the window display
|
|
325 to what it was when you entered the calendar.
|
|
326
|
|
327 @node Holidays, Sunrise/Sunset, General Calendar, Calendar/Diary
|
|
328 @subsection Holidays
|
|
329 @cindex holidays
|
|
330
|
|
331 The Emacs calendar knows about all major and many minor holidays.
|
|
332
|
|
333 @table @kbd
|
|
334 @item h
|
|
335 Display holidays for the date indicated by point
|
|
336 (@code{calendar-cursor-holidays}).
|
|
337 @item x
|
|
338 Mark holidays in the calendar window (@code{mark-calendar-holidays}).
|
|
339 @item u
|
|
340 Unmark calendar window (@code{calendar-unmark}).
|
|
341 @item a
|
|
342 List all holidays for the displayed three months in another window
|
|
343 (@code{list-calendar-holidays}).
|
|
344 @item M-x holidays
|
|
345 List all holidays for three months around today's date in another
|
|
346 window.
|
|
347 @end table
|
|
348
|
|
349 @kindex h (Calendar mode)
|
|
350 @findex calendar-cursor-holidays
|
|
351 To see if any holidays fall on a given date, position point on that
|
|
352 date in the calendar window and use the @kbd{h} command. The holidays
|
|
353 are usually listed in the echo area, but if there are too many to fit in
|
|
354 one line, then they are displayed in a separate window.
|
|
355
|
|
356 @kindex x (Calendar mode)
|
|
357 @findex mark-calendar-holidays
|
|
358 @kindex u (Calendar mode)
|
|
359 @findex calendar-unmark
|
|
360 To find the distribution of holidays for a wider period, you can use the
|
|
361 @kbd{x} command. This places a @samp{*} next to every date on which a holiday
|
|
362 falls. The command applies both to the currently visible dates and to new
|
|
363 dates that become visible by scrolling. To turn marking off and erase the
|
|
364 current marks, type @kbd{u}, which also erases any diary marks (@pxref{Diary}).
|
|
365
|
|
366 @kindex a (Calendar mode)
|
|
367 @findex list-calendar-holidays
|
|
368 To get even more detailed information, use the @kbd{a} command, which
|
|
369 displays a separate buffer containing a list of all holidays in the
|
|
370 current three-month range.
|
|
371
|
|
372 @findex holidays
|
|
373 You can display the list of holidays for the current month and the
|
|
374 preceding and succeeding months even if you don't have a calendar
|
|
375 window. Use the command @kbd{M-x holidays}. If you want the list of
|
|
376 holidays centered around a different month, use @kbd{C-u M-x holidays}
|
|
377 and type the month and year.
|
|
378
|
|
379 The holidays known to Emacs include American holidays and the major
|
|
380 Christian, Jewish, and Islamic holidays; when floating point is available,
|
|
381 Emacs also knows about solstices and equinoxes. The dates used by Emacs
|
|
382 for holidays are based on @emph{current practice}, not historical fact.
|
|
383 Historically, for instance, the start of daylight savings time and even
|
|
384 its existence have varied from year to year. However present American
|
|
385 law mandates that daylight savings time begins on the first Sunday in
|
|
386 April; this is the definition that Emacs uses, even though it is wrong
|
|
387 for some prior years.
|
|
388
|
|
389 @node Sunrise/Sunset, Lunar Phases, Holidays, Calendar/Diary
|
|
390 @subsection Times of Sunrise and Sunset
|
|
391 @cindex sunrise
|
|
392 @cindex sunset
|
|
393
|
|
394 Emacs can tell you, to within a minute or two, the times of sunrise and
|
|
395 sunset for any date, if floating point is available.
|
|
396
|
|
397 @table @kbd
|
|
398 @item S
|
|
399 Display times of sunrise and sunset for the date indicated by point
|
|
400 (@code{calendar-sunrise-sunset}).
|
|
401 @item M-x sunrise-sunset
|
|
402 Display times of sunrise and sunset for today's date.
|
|
403 @end table
|
|
404
|
|
405 @kindex S (Calendar mode)
|
|
406 @findex calendar-sunrise-sunset
|
|
407 @findex sunrise-sunset
|
|
408 Move point to the date you want, and type @kbd{S}, to display the
|
|
409 @emph{local times} of sunrise and sunset in the echo area.
|
|
410
|
|
411 You can display the times of sunrise and sunset for the current date
|
|
412 even if you don't have a calendar window. Use the command @kbd{M-x
|
|
413 sunrise-sunset}. If you want the times of sunrise and sunset for a
|
|
414 different date, use @kbd{C-u M-x sunrise-sunset} and type the year,
|
|
415 month, and day.
|
|
416
|
|
417 Because the times of sunrise and sunset depend on the location on
|
|
418 earth, you need to tell Emacs your latitude, longitude, and location
|
|
419 name. Here is an example of what to set:
|
|
420
|
|
421 @vindex calendar-location-name
|
|
422 @vindex calendar-longitude
|
|
423 @vindex calendar-latitude
|
|
424 @example
|
|
425 (setq calendar-latitude 40.1)
|
|
426 (setq calendar-longitude -88.2)
|
|
427 (setq calendar-location-name "Urbana, IL")
|
|
428 @end example
|
|
429
|
|
430 @noindent
|
|
431 Use one decimal place in the values of @code{calendar-latitude} and
|
|
432 @code{calendar-longitude}.
|
|
433
|
|
434 Your time zone also affects the local time of sunrise and sunset.
|
|
435 Emacs usually gets this information from the operating system, but if
|
|
436 these values are not what you want (or if the operating system does not
|
|
437 supply them), you'll need to set them yourself, like this:
|
|
438
|
|
439 @vindex calendar-time-zone
|
|
440 @vindex calendar-standard-time-zone-name
|
|
441 @vindex calendar-daylight-time-zone-name
|
|
442 @example
|
|
443 (setq calendar-time-zone -360)
|
|
444 (setq calendar-standard-time-zone-name "CST")
|
|
445 (setq calendar-daylight-time-zone-name "CDT")
|
|
446 @end example
|
|
447
|
|
448 @noindent
|
|
449 The value of @code{calendar-time-zone} is the number of minutes
|
|
450 difference between your local standard time and Universal Time
|
|
451 (Greenwich time). The values of @code{calendar-standard-time-zone-name}
|
|
452 and @code{calendar-daylight-time-zone-name} are the abbreviations used
|
|
453 in your time zone.
|
|
454
|
|
455 Emacs displays the times of sunrise and sunset @emph{corrected for
|
|
456 daylight savings time} (this convenience is unusual; most tables of
|
|
457 sunrise and sunset use standard time). The default rule for the
|
|
458 starting and stopping dates of daylight savings time is the American
|
|
459 rule. @xref{Daylight Savings}
|
|
460
|
|
461 You can display the times of sunrise and sunset for any location and
|
|
462 any date with @kbd{C-u C-u M-x sunrise-sunset}. Emacs asks you for a
|
|
463 longitude, latitude, number of minutes difference from Universal time,
|
|
464 and date, and then tells you the times of sunrise and sunset for that
|
|
465 location on that date. The times are usually given in the echo area,
|
|
466 but if the message is too long fit in one line, they are displayed in a
|
|
467 separate window.
|
|
468
|
|
469 @node Lunar Phases, Other Calendars, Sunrise/Sunset, Calendar/Diary
|
|
470 @subsection Phases of the Moon
|
|
471 @cindex phases of the moon
|
|
472 @cindex moon, phases of
|
|
473
|
|
474 Emacs can tell you the dates and times of the phases of the moon (new
|
|
475 moon, first quarter, full moon, last quarter), if floating point is available.
|
|
476
|
|
477 @table @kbd
|
|
478 @item M
|
|
479 List, in another window, the dates and times for all the quarters of the
|
|
480 moon for the three-month period shown in the calendar window
|
|
481 (@code{calendar-phases-of-moon}).
|
|
482 @item M-x phases-of-moon
|
|
483 List dates and times of the quarters of the moon for three months around
|
|
484 today's date in another window.
|
|
485 @end table
|
|
486
|
|
487 @kindex M (Calendar mode)
|
|
488 @findex calendar-phases-of-moon
|
|
489 Use the @kbd{M} command to display a separate buffer of the phases of
|
|
490 the moon for the current three-month range. The dates and times listed
|
|
491 are accurate to within a few minutes.
|
|
492
|
|
493 @findex phases-of-moon
|
|
494 You can display the list of the phases of the moon for the current
|
|
495 month and the preceding and succeeding months even if you don't have a
|
|
496 calendar window. Use the command @kbd{M-x phases-of-moon}. If you want
|
|
497 the phases of the moon centered around a different month, use @kbd{C-u
|
|
498 M-x phases-of-moon} and type the month and year.
|
|
499
|
|
500 @vindex calendar-time-zone
|
|
501 The dates and times given for the phases of the moon are given in
|
|
502 local time (corrected for daylight savings, when appropriate); but if
|
|
503 the variable @code{calendar-time-zone} is void, Universal Time (the
|
|
504 Greenwich time zone) is used. @xref{Daylight Savings}
|
|
505
|
|
506 @node Other Calendars, Diary, Lunar Phases, Calendar/Diary
|
|
507 @subsection Our Calendar and Other Calendars
|
|
508
|
|
509 @cindex Gregorian calendar
|
|
510 The Emacs calendar displayed is @emph{always} the Gregorian calendar,
|
|
511 sometimes called the ``new style'' calendar, which is used in most of
|
|
512 the world today. However, this calendar did not exist before the
|
|
513 sixteenth century and was not widely used before the eighteenth century;
|
|
514 it did not fully displace the Julian calendar and gain universal
|
|
515 acceptance until the early twentieth century. This poses a problem for
|
|
516 the Emacs calendar: you can ask for the calendar of any month starting
|
|
517 with January, year 1 of the current era, but the calendar displayed is
|
|
518 the Gregorian, even for a date at which the Gregorian calendar did not
|
|
519 exist!
|
|
520
|
|
521 Emacs knows about several different calendars, though, not just the
|
|
522 Gregorian calendar. The following commands describe the date indicated
|
|
523 by point in various calendar notations:
|
|
524
|
|
525 @table @kbd
|
|
526 @item p c
|
|
527 Display ISO commercial calendar equivalent for selected day
|
|
528 (@code{calendar-print-iso-date}).
|
|
529 @item p j
|
|
530 Display Julian date for selected day (@code{calendar-print-julian-date}).
|
|
531 @item p a
|
|
532 Display astronomical (Julian) day number for selected day
|
|
533 (@code{calendar-print-astro-day-number}).
|
|
534 @item p h
|
|
535 Display Hebrew date for selected day (@code{calendar-print-hebrew-date}).
|
|
536 @item p i
|
|
537 Display Islamic date for selected day (@code{calendar-print-islamic-date}).
|
|
538 @item p f
|
|
539 Display French Revolutionary date for selected day
|
|
540 (@code{calendar-print-french-date}).
|
|
541 @item p m
|
|
542 Display Mayan date for selected day (@code{calendar-print-mayan-date}).
|
|
543 @end table
|
|
544
|
|
545 If you are interested in these calendars, you can convert dates one at a
|
|
546 time. Put point on the desired date of the Gregorian calendar and press the
|
|
547 appropriate keys. The @kbd{p} is a mnemonic for ``print'' since Emacs
|
|
548 ``prints' the equivalent date in the echo area.
|
|
549
|
|
550 @kindex p c (Calendar mode)
|
|
551 @findex calendar-print-iso-date
|
|
552 @cindex ISO commercial calendar
|
|
553 The ISO commercial calendar is used largely in Europe.
|
|
554
|
|
555 @kindex p j (Calendar mode)
|
|
556 @findex calendar-print-julian-date
|
|
557 @cindex Julian calendar
|
|
558 The Julian calendar, named after Julius Caesar, was the one used in Europe
|
|
559 throughout medieval times, and in many countries up until the nineteenth
|
|
560 century.
|
|
561
|
|
562 @kindex p a (Calendar mode)
|
|
563 @findex calendar-print-astro-day-number
|
|
564 @cindex Julian day numbers
|
|
565 @cindex astronomical day numbers
|
|
566 Astronomers use a simple counting of days elapsed since noon, Monday,
|
|
567 January 1, 4713 B.C. on the Julian calendar. The number of days elapsed
|
|
568 is called the @emph{Julian day number} or the @emph{Astronomical day number}.
|
|
569
|
|
570 @kindex p h (Calendar mode)
|
|
571 @findex calendar-print-hebrew-date
|
|
572 @cindex Hebrew calendar
|
|
573 The Hebrew calendar is the one used to determine the dates of Jewish
|
|
574 holidays. Hebrew calendar dates begin and end at sunset.
|
|
575
|
|
576 @kindex p i (Calendar mode)
|
|
577 @findex calendar-print-islamic-date
|
|
578 @cindex Islamic calendar
|
|
579 The Islamic (Moslem) calendar is the one used to determine the dates
|
|
580 of Moslem holidays. There is no universal agreement in the Islamic
|
|
581 world about the calendar; Emacs uses a widely accepted version, but the
|
|
582 precise dates of Islamic holidays often depend on proclamation by
|
|
583 religious authorities, not on calculations. As a consequence, the
|
|
584 actual dates of occurrence can vary slightly from the dates computed by
|
|
585 Emacs. Islamic calendar dates begin and end at sunset.
|
|
586
|
|
587 @kindex p f (Calendar mode)
|
|
588 @findex calendar-print-french-date
|
|
589 @cindex French Revolutionary calendar
|
|
590 The French Revolutionary calendar was created by the Jacobins after the 1789
|
|
591 revolution, to represent a more secular and nature-based view of the annual
|
|
592 cycle, and to install a 10-day week in a rationalization measure similar to
|
|
593 the metric system. The French government officially abandoned this
|
|
594 calendar at the end of 1805.
|
|
595
|
|
596 @kindex p m (Calendar mode)
|
|
597 @findex calendar-print-mayan-date
|
|
598 @cindex Mayan calendar
|
|
599 The Maya of Central America used three separate, overlapping calendar
|
|
600 systems, the @emph{long count}, the @emph{tzolkin}, and the @emph{haab}.
|
|
601 Emacs knows about all three of these calendars. Experts dispute the
|
|
602 exact correlation between the Mayan calendar and our calendar; Emacs uses the
|
|
603 Goodman-Martinez-Thompson correlation in its calculations.
|
|
604
|
|
605 You can move to dates that you specify on the Commercial, Julian,
|
|
606 astronomical, Hebrew, Islamic, or French calendars:
|
|
607
|
|
608 @kindex g c (Calendar mode)
|
|
609 @findex calendar-goto-iso-date
|
|
610 @kindex g j (Calendar mode)
|
|
611 @findex calendar-goto-julian-date
|
|
612 @kindex g a (Calendar mode)
|
|
613 @findex calendar-goto-astro-day-number
|
|
614 @kindex g h (Calendar mode)
|
|
615 @findex calendar-goto-hebrew-date
|
|
616 @kindex g i (Calendar mode)
|
|
617 @findex calendar-goto-islamic-date
|
|
618 @kindex g f (Calendar mode)
|
|
619 @findex calendar-goto-french-date
|
|
620 @table @kbd
|
|
621 @item g c
|
|
622 Move point to a date specified by the ISO commercial calendar
|
|
623 (@code{calendar-goto-iso-date}).
|
|
624 @item g j
|
|
625 Move point to a date specified by the Julian calendar
|
|
626 (@code{calendar-goto-julian-date}).
|
|
627 @item g a
|
|
628 Move point to a date specified by astronomical (Julian) day number
|
|
629 (@code{calendar-goto-astro-day-number}).
|
|
630 @item g h
|
|
631 Move point to a date specified by the Hebrew calendar
|
|
632 (@code{calendar-goto-hebrew-date}).
|
|
633 @item g i
|
|
634 Move point to a date specified by the Islamic calendar
|
|
635 (@code{calendar-goto-islamic-date}).
|
|
636 @item g f
|
|
637 Move point to a date specified by the French Revolutionary calendar
|
|
638 (@code{calendar-goto-french-date}).
|
|
639 @end table
|
|
640
|
|
641 These commands ask you for a date on the other calendar, move point to
|
|
642 the Gregorian calendar date equivalent to that date, and display the
|
|
643 other calendar's date in the echo area. Emacs uses strict completion
|
|
644 (@pxref{Completion}) whenever it asks you to type a month name, so you
|
|
645 don't have to worry about the spelling of Hebrew, Islamic, or French names.
|
|
646
|
|
647 @findex list-yahrzeit-dates
|
|
648 @cindex yahrzeits
|
|
649 One common question concerning the Hebrew calendar is the computation
|
|
650 of the anniversary of a date of death, called a ``yahrzeit.'' The Emacs
|
|
651 calendar includes a facility for such calculations. If you are in the
|
|
652 calendar, the command @kbd{M-x list-yahrzeit-dates} asks you for a
|
|
653 range of years and then displays a list of the yahrzeit dates for those
|
|
654 years for the date given by point. If you are not in the calendar,
|
|
655 this command first asks you for the date of death and the range of
|
|
656 years, and then displays the list of yahrzeit dates.
|
|
657
|
|
658 Emacs also has many commands for movement on the Mayan calendars.
|
|
659
|
|
660 @table @kbd
|
|
661 @item g m l
|
|
662 Move point to a date specified by the Mayan long count calendar
|
|
663 (@code{calendar-goto-mayan-long-count-date}).
|
|
664 @item g m p t
|
|
665 Move point to the previous occurrence of a date specified by the Mayan
|
|
666 tzolkin calendar (@code{calendar-previous-tzolkin-date}).
|
|
667 @item g m n t
|
|
668 Move point to the next occurrence of a date specified by the Mayan
|
|
669 tzolkin calendar (@code{calendar-next-tzolkin-date}).
|
|
670 @item g m p h
|
|
671 Move point to the previous occurrence of a date specified by the Mayan
|
|
672 haab calendar (@code{calendar-previous-haab-date}).
|
|
673 @item g m n h
|
|
674 Move point to the next occurrence of a date specified by the Mayan
|
|
675 haab calendar (@code{calendar-next-haab-date}).
|
|
676 @item g m p c
|
|
677 Move point to the previous occurrence of a date specified by the Mayan
|
|
678 calendar round (@code{calendar-previous-calendar-round-date}).
|
|
679 @item g m n c
|
|
680 Move point to the next occurrence of a date specified by the Mayan
|
|
681 calendar round (@code{calendar-next-calendar-round-date}).
|
|
682 @end table
|
|
683
|
|
684 @cindex Mayan long count
|
|
685 To understand these commands, you need to understand the Mayan calendars.
|
|
686 The long count is a counting of days with units
|
|
687
|
|
688 @table @asis
|
|
689 @item 1 kin
|
|
690 = 1 day
|
|
691 @item 1 uinal
|
|
692 = 20 kin
|
|
693 @item 1 tun
|
|
694 = 18 uinal
|
|
695 @item 1 katun
|
|
696 = 20 tun
|
|
697 @item 1 baktun
|
|
698 = 20 katun
|
|
699 @end table
|
|
700
|
|
701 @kindex g m l (Calendar mode)
|
|
702 @findex calendar-goto-mayan-long-count-date
|
|
703 @noindent
|
|
704 Thus, the long count date 12.16.11.16.6 means 12 baktun, 16 katun, 11
|
|
705 tun, 16 uinal, and 6 kin. The Emacs calendar can handle Mayan long
|
|
706 count dates as early as 7.17.18.13.1, but no earlier. When you use the
|
|
707 @kbd{g m l} command, type the Mayan long count date with the baktun,
|
|
708 katun, tun, uinal, and kin separated by periods.
|
|
709
|
|
710 @kindex g m p t (Calendar mode)
|
|
711 @findex calendar-previous-tzolkin-date
|
|
712 @kindex g m n t (Calendar mode)
|
|
713 @findex calendar-next-tzolkin-date
|
|
714 @cindex Mayan tzolkin calendar
|
|
715 The Mayan tzolkin calendar is a cycle of 260 days formed by a pair of
|
|
716 independent cycles of 13 and 20 days. Like the haab cycle, this cycle
|
|
717 repeats endlessly, and you can go backward and forward to the previous
|
|
718 or next (respectively) point in the cycle. When you type @kbd{g m p t},
|
|
719 Emacs asks you for a tzolkin date and moves point to the
|
|
720 previous occurrence of that date; type @kbd{g m n t} to go to the next
|
|
721 occurrence.
|
|
722
|
|
723 @kindex g m p h (Calendar mode)
|
|
724 @findex calendar-previous-haab-date
|
|
725 @kindex g m n h (Calendar mode)
|
|
726 @findex calendar-next-haab-date
|
|
727 @cindex Mayan haab calendar
|
|
728 The Mayan haab calendar is a cycle of 365 days arranged as 18 months
|
|
729 of 20 days each, followed a 5-day monthless period. Since this cycle
|
|
730 repeats endlessly, Emacs lets you go backward and forward to the
|
|
731 previous or next (respectively) point in the cycle. Type @kbd{g m p h}
|
|
732 to go to the previous haab date; Emacs asks you for a haab date and
|
|
733 moves point to the previous occurrence of that date. Similarly,
|
|
734 type @kbd{g m n h} to go to the next haab date.
|
|
735
|
|
736 @kindex g m p c (Calendar mode)
|
|
737 @findex calendar-previous-calendar-round-date
|
|
738 @kindex g m n c (Calendar mode)
|
|
739 @findex calendar-next-calendar-round-date
|
|
740 @cindex Mayan calendar round
|
|
741 The Maya also used the combination of the tzolkin date and the haab
|
|
742 date. This combination is a cycle of about 52 years called a
|
|
743 @emph{calendar round}. If you type @kbd{g m p c}, Emacs asks you for
|
|
744 both a haab and a tzolkin date and then moves point to the previous
|
|
745 occurrence of that combination. Use @kbd{g m p c} to move point to the
|
|
746 next occurrence. Emacs signals an error if the haab/tzolkin date you
|
|
747 have typed cannot occur.
|
|
748
|
|
749 Emacs uses strict completion (@pxref{Completion}) whenever it asks you
|
|
750 to type a Mayan name, so you don't have to worry about spelling.
|
|
751
|
|
752 @node Diary, Calendar Customization, Other Calendars, Calendar/Diary
|
|
753 @subsection The Diary
|
|
754 @cindex diary
|
|
755
|
|
756 Associated with the Emacs calendar is a diary that keeps track of
|
|
757 appointments or other events on a daily basis. To use the diary
|
|
758 feature, you must first create a @dfn{diary file} containing a list of
|
|
759 events and their dates. Then Emacs can automatically pick out and
|
|
760 display the events for today, for the immediate future, or for any
|
|
761 specified date.@refill
|
|
762
|
|
763 By default, Emacs expects your diary file to be named @file{~/diary}.
|
|
764 It uses the same format as the @code{calendar} utility. A sample
|
|
765 @file{~/diary} file is:
|
|
766
|
|
767 @example
|
|
768 12/22/1988 Twentieth wedding anniversary!!
|
|
769 &1/1. Happy New Year!
|
|
770 10/22 Ruth's birthday.
|
|
771 * 21, *: Payday
|
|
772 Tuesday--weekly meeting with grad students at 10am
|
|
773 Supowit, Shen, Bitner, and Kapoor to attend.
|
|
774 1/13/89 Friday the thirteenth!!
|
|
775 &thu 4pm squash game with Lloyd.
|
|
776 mar 16 Dad's birthday
|
|
777 April 15, 1989 Income tax due.
|
|
778 &* 15 time cards due.
|
|
779 @end example
|
|
780
|
|
781 Although you probably will start by creating a diary manually, Emacs
|
|
782 provides a number of commands to let you view, add, and change diary
|
|
783 entries. You can also share diary entries with other users
|
|
784 (@pxref{Included Diary Files}).
|
|
785
|
|
786 @menu
|
|
787 * Diary Commands:: Viewing diary entries and associated calendar dates.
|
|
788 * Format of Diary File:: Entering events in your diary.
|
|
789 * Special Diary Entries:: Anniversaries, blocks of dates, cyclic entries, etc.
|
|
790 @end menu
|
|
791
|
|
792 @node Diary Commands, Format of Diary File, Diary, Diary
|
|
793 @subsection Commands Displaying Diary Entries
|
|
794
|
|
795 Once you have created a @file{~/diary} file, you can view it within
|
|
796 Calendar mode. You can also view today's events independently of
|
|
797 Calendar mode.
|
|
798
|
|
799 @table @kbd
|
|
800 @item d
|
|
801 Display any diary entries for the selected date
|
|
802 (@code{view-diary-entries}).
|
|
803 @item s
|
|
804 Display entire diary file (@code{show-all-diary-entries}).
|
|
805 @item m
|
|
806 Mark all visible dates that have diary entries
|
|
807 (@code{mark-diary-entries}).
|
|
808 @item u
|
|
809 Unmark calendar window (@code{calendar-unmark}).
|
|
810 @item M-x print-diary-entries
|
|
811 Print a hard copy of the diary display as it appears.
|
|
812 @item M-x diary
|
|
813 Display any diary entries for today's date.
|
|
814 @end table
|
|
815
|
|
816 @kindex d (Calendar mode)
|
|
817 @findex view-diary-entries
|
|
818 Displaying the diary entries with @kbd{d} shows in a separate window the
|
|
819 diary entries for the date indicated by point in the calendar window. The
|
|
820 mode line of the new window shows the date of the diary entries and any
|
|
821 holidays that fall on that date.
|
|
822
|
|
823 If you specify a numeric argument with @kbd{d}, then all the diary
|
|
824 entries for that many successive days are shown. Thus, @kbd{2 d}
|
|
825 displays all the entries for the selected date and for the following
|
|
826 day.
|
|
827
|
|
828 @kindex m (Calendar mode)
|
|
829 @findex mark-diary-entries
|
|
830 @kindex u (Calendar mode)
|
|
831 @findex calendar-unmark
|
|
832 To get a broader overview of which days are mentioned in the diary, use
|
|
833 the @kbd{m} command to mark those days in the calendar window. The marks
|
|
834 appear next to the dates to which they apply. The @kbd{m} command affects
|
|
835 the dates currently visible and, if you scroll the calendar, newly visible
|
|
836 dates as well. The @kbd{u} command deletes all diary marks (and all
|
|
837 holiday marks too; @pxref{Holidays}), not only in the dates currently
|
|
838 visible, but dates that become visible when you scroll the calendar.
|
|
839
|
|
840 @kindex s (Calendar mode)
|
|
841 @findex show-all-diary-entries
|
|
842 For more detailed information, use the @kbd{s} command, which displays
|
|
843 the entire diary file.
|
|
844
|
|
845 Display of selected diary entries uses the selective display feature,
|
|
846 the same feature that Outline mode uses to show part of an outline
|
|
847 (@pxref{Outline Mode}). This involves hiding the diary entries that are
|
|
848 not relevant, by changing the preceding newline into an ASCII control-m
|
|
849 (code 015). The hidden lines are part of the buffer's text, but they
|
|
850 are invisible; they don't appear on the screen. When you save the diary
|
|
851 file, the control-m characters are saved as newlines; thus, the
|
|
852 invisible lines become ordinary lines in the file.
|
|
853
|
|
854 @findex print-diary-entries
|
|
855 Because the diary buffer as you see it is an illusion, simply printing
|
|
856 the contents does not print what you see on your screen. So there is a
|
|
857 special command to print a hard copy of the buffer @emph{as it appears};
|
|
858 this command is @kbd{M-x print-diary-entries}. It sends the data
|
|
859 directly to the printer. You can customize it like @code{lpr-region}
|
|
860 (@pxref{Hardcopy}).
|
|
861
|
|
862 @findex diary
|
|
863 The command @kbd{M-x diary} displays the diary entries for the current
|
|
864 date, independently of the calendar display, and optionally for the next
|
|
865 few days as well; the variable @code{number-of-diary-entries} specifies
|
|
866 how many days to include (@pxref{Customization}).
|
|
867
|
|
868 If you put in your @file{.emacs} file:
|
|
869
|
|
870 @example
|
|
871 (diary)
|
|
872 @end example
|
|
873
|
|
874 @noindent
|
|
875 it automatically displays a window with the day's diary entries, when
|
|
876 you enter Emacs. The mode line of the displayed window shows the date
|
|
877 and any holidays that fall on that date.
|
|
878
|
|
879 @node Format of Diary File, Special Diary Entries, Diary Commands, Diary
|
|
880 @subsection The Diary File
|
|
881 @cindex diary file
|
|
882
|
|
883 @vindex diary-file
|
|
884 Your @dfn{diary file} is a file that records events associated with
|
|
885 particular dates. The name of the diary file is specified by the variable
|
|
886 @code{diary-file}; @file{~/diary} is the default. You can use the same file
|
|
887 for the @code{calendar} utility program, since its formats are a subset of the
|
|
888 ones allowed by the Emacs Calendar.
|
|
889
|
|
890 Each entry in the file describes one event and consists of one or more
|
|
891 lines. It always begins with a date specification at the left margin.
|
|
892 The rest of the entry is simply text to describe the event. If the
|
|
893 entry has more than one line, then the lines after the first must begin
|
|
894 with whitespace to indicate they continue a previous entry.
|
|
895
|
|
896 Here are some sample diary entries, illustrating different ways of
|
|
897 formatting a date. The examples all show dates in American order (month, day,
|
|
898 year), but Calendar mode offers (day, month, year) ordering too.
|
|
899
|
|
900 @example
|
|
901 4/20/93 Switch-over to new tabulation system
|
|
902 apr. 25 Start tabulating annual results
|
|
903 4/30 Results for April are due
|
|
904 */25 Monthly cycle finishes
|
|
905 Friday Don't leave without backing up files
|
|
906 @end example
|
|
907
|
|
908 The first entry appears only once, on April 20, 1993. The second and
|
|
909 third appear every year on the specified dates, and the fourth uses a
|
|
910 wildcard (asterisk) for the month, so it appears on the 25th of every
|
|
911 month. The final entry appears every week on Friday.
|
|
912
|
|
913 You can also use just numbers to express a date, as in
|
|
914 @samp{@var{month}/@var{day}} or
|
|
915 @samp{@var{month}/@var{day}/@var{year}}. This must be followed by a
|
|
916 nondigit. In the date itself, @var{month} and @var{day} are numbers of
|
|
917 one or two digits. @var{year} is a number and may be abbreviated to the
|
|
918 last two digits; that is, you can use @samp{11/12/1989} or
|
|
919 @samp{11/12/89}.
|
|
920
|
|
921 A date may be @dfn{generic}, or partially unspecified. Then the entry
|
|
922 applies to all dates that match the specification. If the date does
|
|
923 not contain a year, it is generic and applies to any year.
|
|
924 Alternatively, @var{month}, @var{day}, or @var{year} can be a @samp{*};
|
|
925 this matches any month, day, or year, respectively. Thus, a diary entry
|
|
926 @samp{3/*/*} matches any day in March of any year.@refill
|
|
927
|
|
928 Dates can also have the form @samp{@var{monthname} @var{day}} or
|
|
929 @samp{@var{monthname} @var{day}, @var{year}}, where the month's name can
|
|
930 be spelled in full or abbreviated to three characters (with or without a
|
|
931 period). Case is not significant. If the date does not contain a year,
|
|
932 it is generic and applies to any year. Also, @var{monthname},
|
|
933 @var{day}, or @var{year} can be a @samp{*} which matches any month, day,
|
|
934 or year, respectively.@refill
|
|
935
|
|
936 @vindex european-calendar-style
|
|
937 @findex european-calendar
|
|
938 If you prefer the European style of writing dates---in which the day
|
|
939 comes before the month---type @kbd{M-x european-calendar} while in the
|
|
940 calendar, or set the variable @code{european-calendar-style} to @code{t}
|
|
941 in your @file{.emacs} file @emph{before} the calendar or diary command.
|
|
942 This mode interprets all dates in the diary in the European manner, and
|
|
943 also uses European style for displaying diary dates. (Note that there
|
|
944 is no comma after the @var{monthname} in the European style.)@refill
|
|
945
|
|
946 @findex american-calendar
|
|
947 To revert to the (default) American style of writing dates, type @kbd{M-x
|
|
948 american-calendar}.
|
|
949
|
|
950 You can use the name of a day of the week as a generic date which
|
|
951 applies to any date falling on that day of the week. You can abbreviate
|
|
952 the day of the week to three letters (with or without a period) or spell
|
|
953 it in full; it need not be capitalized.
|
|
954
|
|
955 You can inhibit the marking of certain diary entries in the calendar
|
|
956 window; to do this, insert an ampersand (@samp{&}) at the beginning of
|
|
957 the entry, before the date. This has no effect on display of the entry
|
|
958 in the diary window; it affects only marks on dates in the calendar
|
|
959 window. Nonmarking entries are especially useful for generic entries
|
|
960 that would otherwise mark many different dates.
|
|
961
|
|
962 Lines that do not begin with valid dates and do not continue a preceding
|
|
963 entry are ignored.
|
|
964
|
|
965 If the first line of a diary entry consists only of the date or day
|
|
966 name with no following blanks or punctuation, then the diary window
|
|
967 display doesn't include that line; only the continuation lines appear.
|
|
968 For example:
|
|
969
|
|
970 @example
|
|
971 02/11/1989
|
|
972 Bill B. visits Princeton today
|
|
973 2pm Cognitive Studies Committee meeting
|
|
974 2:30-5:30 Liz at Lawrenceville
|
|
975 4:00pm Dentist appt
|
|
976 7:30pm Dinner at George's
|
|
977 8:00-10:00pm concert
|
|
978 @end example
|
|
979
|
|
980 @noindent
|
|
981 appears in the diary window without the date line at the beginning.
|
|
982 This style of entry looks neater when you display just a single day's
|
|
983 entries, but can cause confusion if you ask for more than one day's
|
|
984 entries.
|
|
985
|
|
986 You can edit the diary entries as they appear in the window, but it is
|
|
987 important to remember that the buffer displayed contains the @emph{entire}
|
|
988 diary file, with portions of it concealed from view. This means, for
|
|
989 instance, that the @kbd{C-f} (@code{forward-char}) command can put point
|
|
990 at what appears to be the end of the line, but what is in reality the
|
|
991 middle of some concealed line. @emph{Be careful when editing the diary
|
|
992 entries!} Inserting additional lines or adding/deleting characters in the
|
|
993 middle of a visible line cannot cause problems. Watch out for @kbd{C-e}
|
|
994 (@code{end-of-line}), however; it may put you at the end of a concealed
|
|
995 line far from where point appears to be! Before editing the diary, it
|
|
996 is best to display the entire file with @kbd{s}
|
|
997 (@code{show-all-diary-entries}).@refill
|
|
998
|
|
999 While in the calendar, there are several commands to help you in making
|
|
1000 entries to your diary.
|
|
1001
|
|
1002 @table @kbd
|
|
1003 @item i d
|
|
1004 Add a diary entry for the selected date (@code{insert-diary-entry}).
|
|
1005 @item i w
|
|
1006 Add a diary entry for the selected day of the week (@code{insert-weekly-diary-entry}).
|
|
1007 @item i m
|
|
1008 Add a diary entry for the selected day of the month (@code{insert-monthly-diary-entry}).
|
|
1009 @item i y
|
|
1010 Add a diary entry for the selected day of the year (@code{insert-yearly-diary-entry}).
|
|
1011 @end table
|
|
1012
|
|
1013 @kindex i d (Calendar mode)
|
|
1014 @findex insert-diary-entry
|
|
1015 You can make a diary entry for a specific date by moving point to that
|
|
1016 date in the calendar window and using the @kbd{i d} command. This
|
|
1017 command displays the end of your diary file in another window and
|
|
1018 inserts the date; you can then type the rest of the diary entry.
|
|
1019
|
|
1020 @kindex i w (Calendar mode)
|
|
1021 @findex insert-weekly-diary-entry
|
|
1022 If you want to make a diary entry that applies to a specific day of
|
|
1023 the week, move point to that day of the week (any occurrence will do)
|
|
1024 and use the @kbd{i w} command. This displays the end of your diary file
|
|
1025 in another window and inserts the day-of-week as a generic date; you can
|
|
1026 then type the rest of the diary entry.
|
|
1027
|
|
1028 @kindex i m (Calendar mode)
|
|
1029 @findex insert-monthly-diary-entry
|
|
1030 @kindex i y (Calendar mode)
|
|
1031 @findex insert-yearly-diary-entry
|
|
1032 You make a monthly diary entry in the same fashion. Move point to the
|
|
1033 day of the month, use the @kbd{i m} command, and type the diary entry.
|
|
1034 Similarly, you make a yearly diary entry with the @kbd{i y} command.
|
|
1035
|
|
1036 All of the above commands make marking diary entries. If you want the diary
|
|
1037 entry to be nonmarking, give a prefix argument to the command. For example,
|
|
1038 @kbd{C-u i w} makes a nonmarking, weekly diary entry.
|
|
1039
|
|
1040 If you modify the diary, be sure to write the file before exiting from the
|
|
1041 calendar.
|
|
1042
|
|
1043 @node Special Diary Entries,, Format of Diary File, Diary
|
|
1044 @subsection Special Diary Entries
|
|
1045
|
|
1046 In addition to entries based on calendar dates, your diary file can contain
|
|
1047 entries for regularly occurring events such as anniversaries. These entries
|
|
1048 are based on expressions (sexps) that Emacs evaluates as it scans the diary
|
|
1049 file. Such an entry is indicated by @samp{%%} at the beginning (preceded by
|
|
1050 @samp{&} for a nonmarking entry), followed by a sexp in parentheses. Calendar
|
|
1051 mode offers commands to make it easier to put some of these special entries in
|
|
1052 your diary.
|
|
1053
|
|
1054 @table @kbd
|
|
1055 @item i a
|
|
1056 Add an anniversary diary entry for the selected date (@code{insert-anniversary-diary-entry}).
|
|
1057 @item i b
|
|
1058 Add a block diary entry for the current region (@code{insert-block-diary-entry}).
|
|
1059 @item i c
|
|
1060 Add a cyclic diary entry starting at the date (@code{insert-cyclic-diary-entry}).
|
|
1061 @end table
|
|
1062
|
|
1063 @kindex i a (Calendar mode)
|
|
1064 @findex insert-anniversary-diary-entry
|
|
1065 If you want to make a diary entry that applies to the anniversary of a
|
|
1066 specific date, move point to that date and use the @kbd{i a} command.
|
|
1067 This displays the end of your diary file in another window and inserts
|
|
1068 the anniversary description; you can then type the rest of the diary
|
|
1069 entry.
|
|
1070
|
|
1071 @findex diary-anniversary
|
|
1072 The effect of @kbd{i a} is to add a @code{diary-anniversary} sexp to your
|
|
1073 diary file. You can also add one manually, for instance:
|
|
1074
|
|
1075 @example
|
|
1076 %%(diary-anniversary 10 31 1948) Arthur's birthday
|
|
1077 @end example
|
|
1078
|
|
1079 @noindent
|
|
1080 This entry applies to October 31 in any year after 1948; @samp{10 31 1948}
|
|
1081 specifies the date. (If you are using the European calendar style, the month
|
|
1082 and day are interchanged.) The reason this sexp requires a beginning
|
|
1083 year is that advanced diary functions can use it to calculate the number of
|
|
1084 elapsed years (@pxref{Sexp Diary Entries}).@refill
|
|
1085
|
|
1086 @kindex i b (Calendar mode)
|
|
1087 @findex insert-block-diary-entry
|
|
1088 You can make a diary entry entry for a block of dates by setting the mark
|
|
1089 at the date at one end of the block, moving point to the date at the other
|
|
1090 end of the block, and using the @kbd{i b} command. This command
|
|
1091 causes the end of your diary file to be displayed in another window and the
|
|
1092 block description to be inserted; you can then type the diary entry.
|
|
1093
|
|
1094 @findex diary-block
|
|
1095 Here is such a diary entry that applies to all dates from June 24, 1990
|
|
1096 through July 10, 1990:
|
|
1097
|
|
1098 @example
|
|
1099 %%(diary-block 6 24 1990 7 10 1990) Vacation
|
|
1100 @end example
|
|
1101
|
|
1102 @noindent
|
|
1103 The @samp{6 24 1990} indicates the starting date and the @samp{7 10 1990}
|
|
1104 indicates the stopping date. (Again, if you are using the European calendar
|
|
1105 style, the month and day are interchanged.)
|
|
1106
|
|
1107 @kindex i c (Calendar mode)
|
|
1108 @findex insert-cyclic-diary-entry
|
|
1109 You can specify cyclic diary entries that repeat after a fixed
|
|
1110 interval of days. Move point to the starting date and use the @kbd{i c}
|
|
1111 command. After you specify the length of interval, this command
|
|
1112 displays the end of your diary file in another window and inserts the
|
|
1113 cyclic event description; you can then type the rest of the diary
|
|
1114 entry.
|
|
1115
|
|
1116 The sexp corresponding to the @kbd{i c} command looks like:
|
|
1117
|
|
1118 @findex diary-cyclic
|
|
1119 @example
|
|
1120 %%(diary-cyclic 50 3 1 1990) Renew medication
|
|
1121 @end example
|
|
1122
|
|
1123 @noindent
|
|
1124 which applies to March 1, 1990 and every 50th day following; @samp{3 1 1990}
|
|
1125 specifies the starting date. (If you are using the European calendar style,
|
|
1126 the month and day are interchanged.)
|
|
1127
|
|
1128 All three of the these commands make marking diary entries. If you want the
|
|
1129 diary entry to be nonmarking, give a numeric argument to the command. For
|
|
1130 example, @kbd{C-u i a} makes a nonmarking anniversary diary
|
|
1131 entry.
|
|
1132
|
|
1133 Marking sexp diary entries in the calendar is @emph{extremely}
|
|
1134 time-consuming, since every date visible in the calendar window must be
|
|
1135 individually checked. So it's a good idea to make sexp diary entries
|
|
1136 nonmarking with @samp{&}.
|
|
1137
|
|
1138 One sophisticated kind of sexp, a floating diary entry, has no corresponding
|
|
1139 command. The floating diary entry specifies a regularly-occurring event
|
|
1140 by offsets specified in days, weeks, and months. It is comparable to a
|
|
1141 crontab entry interpreted by the @code{cron} utility on Unix systems.@refill
|
|
1142
|
|
1143 Here is a nonmarking, floating diary entry that applies to the last
|
|
1144 Thursday in November:
|
|
1145
|
|
1146 @findex diary-float
|
|
1147 @example
|
|
1148 &%%(diary-float 11 4 -1) American Thanksgiving
|
|
1149 @end example
|
|
1150
|
|
1151 @noindent
|
|
1152 The 11 specifies November (the eleventh month), the 4 specifies Thursday
|
|
1153 (the fourth day of the week, where Sunday is numbered zero), and the
|
|
1154 @minus{}1 specifies ``last'' (1 would mean ``first'', 2 would mean
|
|
1155 ``second'', @minus{}2 would mean ``second-to-last'', and so on). The
|
|
1156 month can be a single month or a list of months. Thus you could change
|
|
1157 the 11 above to @samp{'(1 2 3)} and have the entry apply to the last
|
|
1158 Thursday of January, February, and March. If the month is @code{t}, the
|
|
1159 entry applies to all months of the year.@refill
|
|
1160
|
|
1161 The sexp feature of the diary allows you to specify diary entries
|
|
1162 based on any Emacs Lisp expression. You can use the library of built-in
|
|
1163 functions or you can write your own functions. The built-in functions
|
|
1164 include the ones shown in this section, plus a few others (@pxref{Sexp
|
|
1165 Diary Entries}).
|
|
1166
|
|
1167 The generality of sexps lets you specify any diary entry that you can
|
|
1168 describe algorithmically. Suppose you get paid on the 21st of the month
|
|
1169 if it is a weekday, and to the Friday before if the 21st is on a
|
|
1170 weekend. The diary entry
|
|
1171
|
|
1172 @example
|
|
1173 &%%(let ((dayname (calendar-day-of-week date))
|
|
1174 (day (car (cdr date))))
|
|
1175 (or (and (= day 21) (memq dayname '(1 2 3 4 5)))
|
|
1176 (and (memq day '(19 20)) (= dayname 5)))
|
|
1177 ) Pay check deposited
|
|
1178 @end example
|
|
1179
|
|
1180 @noindent
|
|
1181 to just those dates. This example illustrates how the sexp can depend
|
|
1182 on the variable @code{date}; this variable is a list (@var{month}
|
|
1183 @var{day} @var{year}) that gives the Gregorian date for which the diary
|
|
1184 entries are being found. If the value of the sexp is @code{t}, the
|
|
1185 entry applies to that date. If the sexp evaluates to @code{nil}, the
|
|
1186 entry does @emph{not} apply to that date.
|
|
1187
|
|
1188
|
|
1189 @node Calendar Customization,, Diary, Calendar/Diary
|
|
1190 @subsection Customizing the Calendar and Diary
|
|
1191
|
|
1192 There are many customizations that you can use to make the calendar and
|
|
1193 diary suit your personal tastes.
|
|
1194
|
|
1195 @menu
|
|
1196 * Calendar Customizing:: Defaults you can set.
|
|
1197 * Holiday Customizing:: Defining your own holidays.
|
|
1198 * Date Display Format:: Changing the format.
|
|
1199 * Time Display Format:: Changing the format.
|
|
1200 * Daylight Savings:: Changing the default.
|
|
1201 * Diary Customizing:: Defaults you can set.
|
|
1202 * Hebrew/Islamic Entries:: How to obtain them.
|
|
1203 * Fancy Diary Display:: Enhancing the diary display, sorting entries.
|
|
1204 * Included Diary Files:: Sharing a common diary file.
|
|
1205 * Sexp Diary Entries:: Fancy things you can do.
|
|
1206 * Appt Customizing:: Customizing appointment reminders.
|
|
1207 @end menu
|
|
1208
|
|
1209 @node Calendar Customizing
|
|
1210 @subsubsection Customizing the Calendar
|
|
1211 @vindex view-diary-entries-initially
|
|
1212
|
|
1213 If you set the variable @code{view-diary-entries-initially} to
|
|
1214 @code{t}, calling up the calendar automatically displays the diary
|
|
1215 entries for the current date as well. The diary dates appear only if
|
|
1216 the current date is visible. If you add both of the following lines to
|
|
1217 your @file{.emacs} file:@refill
|
|
1218
|
|
1219 @example
|
|
1220 (setq view-diary-entries-initially t)
|
|
1221 (calendar)
|
|
1222 @end example
|
|
1223
|
|
1224 @noindent
|
|
1225 they display both the calendar and diary windows whenever you start Emacs.
|
|
1226
|
|
1227 @vindex view-calendar-holidays-initially
|
|
1228 Similarly, if you set the variable
|
|
1229 @code{view-calendar-holidays-initially} to @code{t}, entering the
|
|
1230 calendar automatically displays a list of holidays for the current three
|
|
1231 month period. The holiday list appears in a separate window.@refill
|
|
1232
|
|
1233 @vindex mark-diary-entries-in-calendar
|
|
1234 You can set the variable @code{mark-diary-entries-in-calendar} to @code{t}
|
|
1235 in order to place a plus sign (@samp{+}) beside any dates with diary entries.
|
|
1236 Whenever the calendar window is displayed or redisplayed, the diary entries
|
|
1237 are automatically marked for holidays.
|
|
1238
|
|
1239 @vindex mark-holidays-in-calendar
|
|
1240 Similarly, setting the variable @code{mark-holidays-in-calendar} to
|
|
1241 @code{t} places an asterisk (@samp{*}) after all holiday dates visible
|
|
1242 in the calendar window.
|
|
1243
|
|
1244 @vindex calendar-load-hook
|
|
1245 There are many customizations that you can make with the hooks
|
|
1246 provided. For example, the variable @code{calendar-load-hook}, whose
|
|
1247 default value is @code{nil}, is a normal hook run when the calendar
|
|
1248 package is first loaded (before actually starting to display the
|
|
1249 calendar).
|
|
1250
|
|
1251 @vindex initial-calendar-window-hook
|
|
1252 The variable @code{initial-calendar-window-hook}, whose default value
|
|
1253 is @code{nil}, is a normal hook run the first time the calendar window
|
|
1254 is displayed. The function is invoked only when you first enter
|
|
1255 Calendar mode, not when you redisplay an existing Calendar window. But
|
|
1256 if you leave the calendar with the @kbd{q} command and reenter it, the
|
|
1257 hook runs again.@refill
|
|
1258
|
|
1259 @vindex today-visible-calendar-hook
|
|
1260 The variable @code{today-visible-calendar-hook}, whose default value
|
|
1261 is @code{nil}, is a normal hook run after the calendar buffer has been
|
|
1262 prepared with the calendar when the current date is visible in the
|
|
1263 window. One use of this hook is to replace today's date with asterisks;
|
|
1264 a function @code{calendar-star-date} is included for this purpose. In
|
|
1265 your @file{.emacs} file, put:@refill
|
|
1266
|
|
1267 @findex calendar-star-date
|
|
1268 @example
|
|
1269 (setq today-visible-calendar-hook 'calendar-star-date)
|
|
1270 @end example
|
|
1271
|
|
1272 @noindent
|
|
1273 Another standard hook function adds asterisks around the current date.
|
|
1274 Here's how to use it:
|
|
1275
|
|
1276 @findex calendar-mark-today
|
|
1277 @example
|
|
1278 (setq today-visible-calendar-hook 'calendar-mark-today)
|
|
1279 @end example
|
|
1280
|
|
1281 @vindex today-invisible-calendar-hook
|
|
1282 @noindent
|
|
1283 A corresponding variable, @code{today-invisible-calendar-hook}, whose
|
|
1284 default value is @code{nil}, is a normal hook run after the calendar
|
|
1285 buffer text has been prepared, if the current date is @emph{not} visible
|
|
1286 in the window.@refill
|
|
1287
|
|
1288 @node Holiday Customizing
|
|
1289 @subsubsection Customizing the Holidays
|
|
1290
|
|
1291 @vindex calendar-holidays
|
|
1292 @vindex christian-holidays
|
|
1293 @vindex hebrew-holidays
|
|
1294 @vindex islamic-holidays
|
|
1295 Emacs knows about holidays defined by entries on one of several lists.
|
|
1296 You can customize theses lists of holidays to your own needs, adding
|
|
1297 holidays or deleting lists of holidays. The lists of holidays that
|
|
1298 Emacs uses are for general holidays (@code{general-holidays}), local
|
|
1299 holidays (@code{local-holidays}), Christian holidays
|
|
1300 (@code{christian-holidays}), Hebrew (Jewish) holidays
|
|
1301 (@code{hebrew-holidays}), Islamic (Moslem) holidays
|
|
1302 (@code{islamic-holidays}), and other holidays (@code{other-holidays}).
|
|
1303
|
|
1304 @vindex general-holidays
|
|
1305 The general holidays are, by default, holidays common throughout the
|
|
1306 United States. To eliminate these holidays, set @code{general-holidays}
|
|
1307 to @code{nil}.
|
|
1308
|
|
1309 @vindex local-holidays
|
|
1310 There are no default local holidays (but sites may supply some). You
|
|
1311 can set the variable @code{local-holidays} to any list of holidays, as
|
|
1312 described below.
|
|
1313
|
|
1314 @vindex all-christian-calendar-holidays
|
|
1315 @vindex all-hebrew-calendar-holidays
|
|
1316 @vindex all-islamic-calendar-holidays
|
|
1317 By default, Emacs does not consider all the holidays of these
|
|
1318 religions, only those commonly found in secular calendars. For a more
|
|
1319 extensive collection of religious holidays, you can set any (or all) of
|
|
1320 the variables @code{all-christian-calendar-holidays},
|
|
1321 @code{all-hebrew-calendar-holidays}, or
|
|
1322 @code{all-islamic-calendar-holidays} to @code{t}. If you want to
|
|
1323 eliminate the religious holidays, set any or all of the corresponding
|
|
1324 variables @code{christian-holidays}, @code{hebrew-holidays}, and
|
|
1325 @code{islamic-holidays} to @code{nil}.@refill
|
|
1326
|
|
1327 @vindex other-holidays
|
|
1328 You can set the variable @code{other-holidays} to any list of
|
|
1329 holidays. This list, normally empty, is intended for your use.
|
|
1330
|
|
1331 @cindex holiday forms
|
|
1332 Each of the lists (@code{general-holidays}, @code{local-holidays},
|
|
1333 @code{christian-holidays}, @code{hebrew-holidays},
|
|
1334 @code{islamic-holidays}, and @code{other-holidays}) is a list of
|
|
1335 @dfn{holiday forms}, each holiday form describing a holiday (or
|
|
1336 sometimes a list of holidays). Holiday forms may have the following
|
|
1337 formats:
|
|
1338
|
|
1339 @table @code
|
|
1340 @item (holiday-fixed @var{month} @var{day} @var{string})
|
|
1341 A fixed date on the Gregorian calendar. @var{month} and @var{day} are
|
|
1342 numbers, @var{string} is the name of the holiday.
|
|
1343
|
|
1344 @item (holiday-float @var{month} @var{dayname} @var{k} @var{string})
|
|
1345 The @var{k}th @var{dayname} in @var{month} on the Gregorian calendar
|
|
1346 (@var{dayname}=0 for Sunday, and so on); negative @var{k} means count back
|
|
1347 from the end of the month. @var{string} is the name of the holiday.
|
|
1348
|
|
1349 @item (holiday-hebrew @var{month} @var{day} @var{string})
|
|
1350 A fixed date on the Hebrew calendar. @var{month} and @var{day} are
|
|
1351 numbers, @var{string} is the name of the holiday.
|
|
1352
|
|
1353 @item (holiday-islamic @var{month} @var{day} @var{string})
|
|
1354 A fixed date on the Islamic calendar. @var{month} and @var{day} are
|
|
1355 numbers, @var{string} is the name of the holiday.
|
|
1356
|
|
1357 @item (holiday-julian @var{month} @var{day} @var{string})
|
|
1358 A fixed date on the Julian calendar. @var{month} and @var{day} are
|
|
1359 numbers, @var{string} is the name of the holiday.
|
|
1360
|
|
1361 @item (holiday-sexp @var{sexp} @var{string})
|
|
1362 @var{sexp} is a Lisp expression that should use the variable @code{year}
|
|
1363 to compute the date of a holiday, or @code{nil} if the holiday doesn't
|
|
1364 happen this year. The value represents the date as a list of the form
|
|
1365 @code{(@var{month} @var{day} @var{year})}. @var{string} is the name of
|
|
1366 the holiday.
|
|
1367
|
|
1368 @item (if @var{boolean} @var{holiday-form} &optional @var{holiday-form})
|
|
1369 A choice between two holidays based on the value of @var{boolean}.
|
|
1370
|
|
1371 @item (@var{function} &optional @var{args})
|
|
1372 Dates requiring special computation; @var{args}, if any, are passed in
|
|
1373 a list to the function @code{calendar-holiday-function-@var{function}}.
|
|
1374 @end table
|
|
1375
|
|
1376 For example, suppose you want to add Bastille Day, celebrated in
|
|
1377 France on July 14. You can do this by adding the following line
|
|
1378 to your @file{.emacs} file:
|
|
1379
|
|
1380 @smallexample
|
|
1381 (setq other-holidays '((holiday-fixed 7 14 "Bastille Day")))
|
|
1382 @end smallexample
|
|
1383
|
|
1384 @noindent
|
|
1385 The holiday form @code{(holiday-fixed 7 14 "Bastille Day")} specifies the
|
|
1386 fourteenth day of the seventh month (July).
|
|
1387
|
|
1388 Many holidays occur on a specific day of the week, at a specific time
|
|
1389 of month. Here is a holiday form describing Hurricane Supplication Day,
|
|
1390 celebrated in the Virgin Islands on the fourth Monday in August:
|
|
1391
|
|
1392 @smallexample
|
|
1393 (holiday-float 8 1 4 "Hurricane Supplication Day")
|
|
1394 @end smallexample
|
|
1395
|
|
1396 @noindent
|
|
1397 Here the 8 specifies August, the 1 specifies Monday (Sunday is 0,
|
|
1398 Tuesday is 2, and so on), and the 4 specifies the fourth occurrence in
|
|
1399 the month (1 specifies the first occurrence, 2 the second occurrence,
|
|
1400 @minus{}1 the last occurrence, @minus{}2 the second-to-last occurrence, and
|
|
1401 so on).
|
|
1402
|
|
1403 You can specify holidays that occur on fixed days of the Hebrew,
|
|
1404 Islamic, and Julian calendars too. For example,
|
|
1405
|
|
1406 @smallexample
|
|
1407 (setq other-holidays
|
|
1408 '((holiday-hebrew 10 2 "Last day of Hanukkah")
|
|
1409 (holiday-islamic 3 12 "Mohammed's Birthday")
|
|
1410 (holiday-julian 4 2 "Jefferson's Birthday")))
|
|
1411 @end smallexample
|
|
1412
|
|
1413 @noindent
|
|
1414 adds the last day of Hanukkah (since the Hebrew months are numbered with
|
|
1415 1 starting from Nisan), the Islamic feast celebrating Mohammed's
|
|
1416 birthday (since the Islamic months are numbered from 1 starting with
|
|
1417 Muharram), and Thomas Jefferson's birthday, which is 2 April 1743 on the
|
|
1418 Julian calendar.
|
|
1419
|
|
1420 To include a holiday conditionally, use either the @samp{if} or the
|
|
1421 @samp{sexp} form. For example, American presidential elections occur on
|
|
1422 the first Tuesday after the first Monday in November of years divisible
|
|
1423 by 4:
|
|
1424
|
|
1425 @smallexample
|
|
1426 (holiday-sexp (if (= 0 (% year 4))
|
|
1427 (calendar-gregorian-from-absolute
|
|
1428 (1+ (calendar-dayname-on-or-before
|
|
1429 1 (+ 6 (calendar-absolute-from-gregorian
|
|
1430 (list 11 1 year))))))
|
|
1431 "US Presidential Election"))
|
|
1432 @end smallexample
|
|
1433
|
|
1434 @noindent
|
|
1435 or
|
|
1436
|
|
1437 @smallexample
|
|
1438 (if (= 0 (% displayed-year 4))
|
|
1439 (fixed 11
|
|
1440 (extract-calendar-day
|
|
1441 (calendar-gregorian-from-absolute
|
|
1442 (1+ (calendar-dayname-on-or-before
|
|
1443 1 (+ 6 (calendar-absolute-from-gregorian
|
|
1444 (list 11 1 displayed-year)))))))
|
|
1445 "US Presidential Election"))
|
|
1446 @end smallexample
|
|
1447
|
|
1448 Some holidays just don't fit into any of these forms because special
|
|
1449 calculations are involved in their determination. In such cases you
|
|
1450 must write a Lisp function to do the calculation. To include
|
|
1451 eclipses of the sun, for example, add @code{(eclipses)} to
|
|
1452 @code{other-holidays} and write an Emacs Lisp function
|
|
1453 @code{eclipses} that returns a (possibly
|
|
1454 empty) list of the relevant Gregorian dates among the
|
|
1455 range visible in the calendar window, with descriptive strings, like
|
|
1456 this:
|
|
1457
|
|
1458 @smallexample
|
|
1459 (((6 27 1991) "Lunar Eclipse") ((7 11 1991) "Solar Eclipse") ... )
|
|
1460 @end smallexample
|
|
1461
|
|
1462 @node Date Display Format
|
|
1463 @subsubsection Date Display Format
|
|
1464 @vindex calendar-date-display-form
|
|
1465
|
|
1466 You can customize the manner of displaying dates in the diary,
|
|
1467 in mode lines, and in messages by setting
|
|
1468 @code{calendar-date-display-form}. This variable is a list of
|
|
1469 expressions that can involve the variables @code{month}, @code{day}, and
|
|
1470 @code{year}, all numbers in string form, and @code{monthname} and
|
|
1471 @code{dayname}, both alphabetic strings. In the American style, the
|
|
1472 default value of this list is as follows:
|
|
1473
|
|
1474 @smallexample
|
|
1475 ((if dayname (concat dayname ", ")) monthname " " day ", " year)
|
|
1476 @end smallexample
|
|
1477
|
|
1478 @noindent
|
|
1479 while in the European style this value is the default:
|
|
1480
|
|
1481 @smallexample
|
|
1482 ((if dayname (concat dayname ", ")) day " " monthname " " year)
|
|
1483 @end smallexample
|
|
1484
|
|
1485 The ISO standard date representation is this:
|
|
1486
|
|
1487 @smallexample
|
|
1488 (year "-" month "-" day)
|
|
1489 @end smallexample
|
|
1490
|
|
1491 @noindent
|
|
1492 This specifies a typical American format:
|
|
1493
|
|
1494 @smallexample
|
|
1495 (month "/" day "/" (substring year -2))
|
|
1496 @end smallexample
|
|
1497
|
|
1498 @node Time Display Format
|
|
1499 @subsubsection Time Display Format
|
|
1500 @vindex calendar-time-display-form
|
|
1501
|
|
1502 In the calendar, diary, and related buffers, Emacs displays times of
|
|
1503 day in the conventional American style with the hours from 1 through 12,
|
|
1504 minutes, and either @samp{am} or @samp{pm}. If you prefer the
|
|
1505 ``military'' (European) style of writing times---in which the hours go
|
|
1506 from 00 to 23---you can alter the variable
|
|
1507 @code{calendar-time-display-form}. This variable is a list of
|
|
1508 expressions that can involve the variables @code{12-hours},
|
|
1509 @code{24-hours}, and @code{minutes}, all numbers in string form, and
|
|
1510 @code{am-pm} and @code{time-zone}, both alphabetic strings. The default
|
|
1511 definition of @code{calendar-time-display-form} is as follows:
|
|
1512
|
|
1513 @smallexample
|
|
1514 (12-hours ":" minutes am-pm
|
|
1515 (if time-zone " (") time-zone (if time-zone ")"))
|
|
1516 @end smallexample
|
|
1517
|
|
1518 Setting @code{calendar-time-display-form} to
|
|
1519
|
|
1520 @smallexample
|
|
1521 (24-hours ":" minutes
|
|
1522 (if time-zone " (") time-zone (if time-zone ")"))
|
|
1523 @end smallexample
|
|
1524
|
|
1525 @noindent
|
|
1526 gives military-style times like @samp{21:07 (UT)} if time zone names are
|
|
1527 defined, and times like @samp{21:07} if they are not.
|
|
1528
|
|
1529 @node Daylight Savings
|
|
1530 @subsubsection Daylight Savings Time
|
|
1531 @cindex daylight savings time
|
|
1532
|
|
1533 Emacs understands the difference between standard time and daylight
|
|
1534 savings time---the times given for sunrise, sunset, solstices,
|
|
1535 equinoxes, and the phases of the moon take that into account. The rules
|
|
1536 for daylight savings time vary from place to place and have also varied
|
|
1537 historically from year to year. To do the job properly, Emacs needs to
|
|
1538 know which rules to use.
|
|
1539
|
|
1540 Some operating systems keep track of the rules that apply to the place
|
|
1541 where you are; on these systems, Emacs gets the information it needs
|
|
1542 from the system automatically. If some or all of this information is
|
|
1543 missing, Emacs fills in the gaps with the rules currently used in
|
|
1544 Cambridge, Massachusetts. If the default choice of rules is not
|
|
1545 appropriate for your location, you can tell Emacs the rules to use by
|
|
1546 setting certain variables.
|
|
1547
|
|
1548 @vindex calendar-daylight-savings-starts
|
|
1549 @vindex calendar-daylight-savings-ends
|
|
1550 These variables are @code{calendar-daylight-savings-starts} and
|
|
1551 @code{calendar-daylight-savings-ends}. Their values should be Lisp
|
|
1552 expressions that refer to the variable @code{year}, and evaluate to the
|
|
1553 Gregorian date on which daylight savings time starts or (respectively)
|
|
1554 ends, in the form of a list @code{(@var{month} @var{day} @var{year})}.
|
|
1555 The values should be @code{nil} if your area does not use daylight
|
|
1556 savings time.
|
|
1557
|
|
1558 Emacs uses these expressions to determine the starting date of
|
|
1559 daylight savings time for the holiday list and for correcting times of
|
|
1560 day in the solar and lunar calculations.
|
|
1561
|
|
1562 The values for Cambridge, Massachusetts are as follows:
|
|
1563
|
|
1564 @example
|
|
1565 @group
|
|
1566 (calendar-nth-named-day 1 0 4 year)
|
|
1567 (calendar-nth-named-day -1 0 10 year)
|
|
1568 @end group
|
|
1569 @end example
|
|
1570
|
|
1571 @noindent
|
|
1572 i.e. the first 0th day (Sunday) of the fourth month (April) in
|
|
1573 the year specified by @code{year}, and the last Sunday of the tenth month
|
|
1574 (October) of that year. If daylight savings time were
|
|
1575 changed to start on October 1, you would set
|
|
1576 @code{calendar-daylight-savings-starts} to this:
|
|
1577
|
|
1578 @example
|
|
1579 (list 10 1 year)
|
|
1580 @end example
|
|
1581
|
|
1582 For a more complex example, suppose daylight savings time begins on
|
|
1583 the first of Nisan on the Hebrew calendar. You would set
|
|
1584 @code{calendar-daylight-savings-starts} as follows:
|
|
1585
|
|
1586 @example
|
|
1587 (calendar-gregorian-from-absolute
|
|
1588 (calendar-absolute-from-hebrew
|
|
1589 (list 1 1 (+ year 3760))))
|
|
1590 @end example
|
|
1591
|
|
1592 @noindent
|
|
1593 because Nisan is the first month in the Hebrew calendar and the Hebrew
|
|
1594 year differs from the Gregorian year by 3760 at Nisan.
|
|
1595
|
|
1596 If there is no daylight savings time at your location, or if you want
|
|
1597 all times in standard time, set @code{calendar-daylight-savings-starts}
|
|
1598 and @code{calendar-daylight-savings-ends} to @code{nil}.
|
|
1599
|
|
1600 @vindex calendar-daylight-time-offset
|
|
1601 This variable specifies the difference between daylight savings time and
|
|
1602 standard time, measured in minutes. The value for Cambridge is 60.
|
|
1603
|
|
1604 @vindex calendar-daylight-savings-starts-time
|
|
1605 @vindex calendar-daylight-savings-ends-time
|
|
1606 These variables specify is the number of minutes after midnight local time
|
|
1607 when the transition to and from daylight savings time should occur. For
|
|
1608 Cambridge, both variables' values are 120.
|
|
1609
|
|
1610 @node Diary Customizing
|
|
1611 @subsubsection Customizing the Diary
|
|
1612
|
|
1613 @vindex holidays-in-diary-buffer
|
|
1614 Ordinarily, the mode line of the diary buffer window indicates any
|
|
1615 holidays that fall on the date of the diary entries. The process of
|
|
1616 checking for holidays can take several seconds, so including holiday
|
|
1617 information delays the display of the diary buffer noticeably. If you'd
|
|
1618 prefer to have a faster display of the diary buffer but without the
|
|
1619 holiday information, set the variable @code{holidays-in-diary-buffer} to
|
|
1620 @code{nil}.@refill
|
|
1621
|
|
1622 @vindex number-of-diary-entries
|
|
1623 The variable @code{number-of-diary-entries} controls the number of
|
|
1624 days of diary entries to be displayed at one time. It affects the
|
|
1625 initial display when @code{view-diary-entries-initially} is @code{t}, as
|
|
1626 well as the command @kbd{M-x diary}. For example, the default value is
|
|
1627 1, which says to display only the current day's diary entries. If the
|
|
1628 value is 2, both the current day's and the next day's entries are
|
|
1629 displayed. The value can also be a vector of seven elements: if the
|
|
1630 value is @code{[0 2 2 2 2 4 1]} then no diary entries appear on Sunday,
|
|
1631 the current date's and the next day's diary entries appear Monday
|
|
1632 through Thursday, Friday through Monday's entries appear on Friday,
|
|
1633 while on Saturday only that day's entries appear.
|
|
1634
|
|
1635 @vindex print-diary-entries-hook
|
|
1636 @findex print-diary-entries
|
|
1637 The variable @code{print-diary-entries-hook} is a normal hook run
|
|
1638 after preparation of a temporary buffer containing just the diary
|
|
1639 entries currently visible in the diary buffer. (The other, irrelevant
|
|
1640 diary entries are really absent from the temporary buffer; in the diary
|
|
1641 buffer, they are merely hidden.) The default value of this hook does
|
|
1642 the printing with the command @code{lpr-buffer}. If you want to use a
|
|
1643 different command to do the printing, just change the value of this
|
|
1644 hook. Other uses might include, for example, rearranging the lines into
|
|
1645 order by day and time.
|
|
1646
|
|
1647 @vindex diary-date-forms
|
|
1648 You can customize the form of dates in your diary file, if neither the
|
|
1649 standard American nor European styles suits your needs, by setting the
|
|
1650 variable @code{diary-date-forms}. This variable is a list of forms of
|
|
1651 dates recognized in the diary file. Each form is a list of regular
|
|
1652 expressions (@pxref{Regexps}) and the variables @code{month},
|
|
1653 @code{day}, @code{year}, @code{monthname}, and @code{dayname}. The
|
|
1654 variable @code{monthname} matches the name of the month, capitalized or
|
|
1655 not, or its three-letter abbreviation, followed by a period or not; it
|
|
1656 matches @samp{*}. Similarly, @code{dayname} matches the name of the
|
|
1657 day, capitalized or not, or its three-letter abbreviation, followed by a
|
|
1658 period or not. The variables @code{month}, @code{day}, and @code{year}
|
|
1659 match those numerical values, preceded by arbitrarily many zeros; they
|
|
1660 also match @samp{*}. The default value of @code{diary-date-forms} in
|
|
1661 the American style is
|
|
1662
|
|
1663 @example
|
|
1664 ((month "/" day "[^/0-9]")
|
|
1665 (month "/" day "/" year "[^0-9]")
|
|
1666 (monthname " *" day "[^,0-9]")
|
|
1667 (monthname " *" day ", *" year "[^0-9]")
|
|
1668 (dayname "\\W"))
|
|
1669 @end example
|
|
1670
|
|
1671 @noindent
|
|
1672 Emacs matches of the diary entries with the date forms is done with the
|
|
1673 standard syntax table from Fundamental mode
|
|
1674 (@pxref{Syntax Tables,,,lispref,XEmacs Lisp Reference Manual}),
|
|
1675 but with the @samp{*} changed so that it is a word constituent.@refill
|
|
1676
|
|
1677 The forms on the list must be @emph{mutually exclusive} and must not
|
|
1678 match any portion of the diary entry itself, just the date. If, to be
|
|
1679 mutually exclusive, the pattern must match a portion of the diary entry
|
|
1680 itself, the first element of the form @emph{must} be @code{backup}.
|
|
1681 This causes the date recognizer to back up to the beginning of the
|
|
1682 current word of the diary entry. Even if you use @code{backup}, the
|
|
1683 form must absolutely not match more than a portion of the first word of
|
|
1684 the diary entry. The default value of @code{diary-date-forms} in the
|
|
1685 European style is this list:
|
|
1686
|
|
1687 @example
|
|
1688 ((day "/" month "[^/0-9]")
|
|
1689 (day "/" month "/" year "[^0-9]")
|
|
1690 (backup day " *" monthname "\\W+\\<[^*0-9]")
|
|
1691 (day " *" monthname " *" year "[^0-9]")
|
|
1692 (dayname "\\W"))
|
|
1693 @end example
|
|
1694
|
|
1695 @noindent
|
|
1696 Notice the use of @code{backup} in the middle form because part of the
|
|
1697 diary entry must be matched to distinguish this form from the following one.
|
|
1698
|
|
1699 @node Hebrew/Islamic Entries
|
|
1700 @subsubsection Hebrew- and Islamic-Date Diary Entries
|
|
1701
|
|
1702 Your diary file can have entries based on Hebrew or Islamic dates, as
|
|
1703 well as entries based on our usual Gregorian calendar. However, because
|
|
1704 the processing of such entries is time-consuming and most people don't
|
|
1705 need them, you must customize the processing of your diary file to
|
|
1706 specify that you want such entries recognized. If you want Hebrew-date
|
|
1707 diary entries, for example, you must include these lines in your
|
|
1708 @file{.emacs} file:
|
|
1709
|
|
1710 @vindex nongregorian-diary-listing-hook
|
|
1711 @vindex nongregorian-diary-marking-hook
|
|
1712 @findex list-hebrew-diary-entries
|
|
1713 @findex mark-hebrew-diary-entries
|
|
1714 @smallexample
|
|
1715 (setq nongregorian-diary-listing-hook 'list-hebrew-diary-entries)
|
|
1716 (setq nongregorian-diary-marking-hook 'mark-hebrew-diary-entries)
|
|
1717 @end smallexample
|
|
1718
|
|
1719 @noindent
|
|
1720 If you want Islamic-date entries, include these lines in your
|
|
1721 @file{.emacs} file:
|
|
1722
|
|
1723 @findex list-islamic-diary-entries
|
|
1724 @findex mark-islamic-diary-entries
|
|
1725 @smallexample
|
|
1726 (setq nongregorian-diary-listing-hook 'list-islamic-diary-entries)
|
|
1727 (setq nongregorian-diary-marking-hook 'mark-islamic-diary-entries)
|
|
1728 @end smallexample
|
|
1729
|
|
1730 @noindent
|
|
1731 If you want both Hebrew- and Islamic-date entries, include these lines:
|
|
1732
|
|
1733 @smallexample
|
|
1734 (setq nongregorian-diary-listing-hook
|
|
1735 '(list-hebrew-diary-entries list-islamic-diary-entries))
|
|
1736 (setq nongregorian-diary-marking-hook
|
|
1737 '(mark-hebrew-diary-entries mark-islamic-diary-entries))
|
|
1738 @end smallexample
|
|
1739
|
|
1740 Hebrew- and Islamic-date diary entries have the same formats as
|
|
1741 Gregorian-date diary entries, except that the date must be preceded with
|
|
1742 an @samp{H} for Hebrew dates and an @samp{I} for Islamic dates.
|
|
1743 Moreover, because the Hebrew and Islamic month names are not uniquely
|
|
1744 specified by the first three letters, you may not abbreviate them. For
|
|
1745 example, a diary entry for the Hebrew date Heshvan 25 could look like
|
|
1746
|
|
1747 @smallexample
|
|
1748 HHeshvan 25 Happy Hebrew birthday!
|
|
1749 @end smallexample
|
|
1750
|
|
1751 @noindent
|
|
1752 and would appear in the diary for any date that corresponds to Heshvan 25
|
|
1753 on the Hebrew calendar. Similarly, an Islamic-date diary entry might be
|
|
1754
|
|
1755 @smallexample
|
|
1756 IDhu al-Qada 25 Happy Islamic birthday!
|
|
1757 @end smallexample
|
|
1758
|
|
1759 @noindent
|
|
1760 and would appear in the diary for any date that corresponds to Dhu al-Qada 25
|
|
1761 on the Islamic calendar.
|
|
1762
|
|
1763 As with Gregorian-date diary entries, Hebrew- and Islamic-date entries
|
|
1764 are nonmarking if they are preceded with an ampersand (@samp{&}).
|
|
1765
|
|
1766 There are commands to help you in making Hebrew- and Islamic-date
|
|
1767 entries to your diary:
|
|
1768
|
|
1769 @table @kbd
|
|
1770 @item i h d
|
|
1771 Add a diary entry for the Hebrew date corresponding to the selected date
|
|
1772 (@code{insert-hebrew-diary-entry}).
|
|
1773 @item i h m
|
|
1774 Add a diary entry for the day of the Hebrew month corresponding to the
|
|
1775 selected date (@code{insert-monthly-hebrew-diary-entry}).
|
|
1776 @item i h y
|
|
1777 Add a diary entry for the day of the Hebrew year corresponding to the
|
|
1778 selected date (@code{insert-yearly-hebrew-diary-entry}).
|
|
1779 @item i i d
|
|
1780 Add a diary entry for the Islamic date corresponding to the selected date
|
|
1781 (@code{insert-islamic-diary-entry}).
|
|
1782 @item i i m
|
|
1783 Add a diary entry for the day of the Islamic month corresponding to the
|
|
1784 selected date (@code{insert-monthly-islamic-diary-entry}).
|
|
1785 @item i i y
|
|
1786 Add a diary entry for the day of the Islamic year corresponding to the
|
|
1787 selected date (@code{insert-yearly-islamic-diary-entry}).
|
|
1788 @end table
|
|
1789
|
|
1790 @findex insert-hebrew-diary-entry
|
|
1791 @findex insert-monthly-hebrew-diary-entry
|
|
1792 @findex insert-yearly-hebrew-diary-entry
|
|
1793 @findex insert-islamic-diary-entry
|
|
1794 @findex insert-monthly-islamic-diary-entry
|
|
1795 @findex insert-yearly-islamic-diary-entry
|
|
1796 These commands work exactly like the corresponding commands for ordinary
|
|
1797 diary entries: Move point to a date in the calendar window and the above
|
|
1798 commands insert the Hebrew or Islamic date (corresponding to the date
|
|
1799 indicated by point) at the end of your diary file and you can then type the
|
|
1800 diary entry. If you want the diary entry to be nonmarking, give a numeric
|
|
1801 argument to the command.
|
|
1802
|
|
1803 @node Fancy Diary Display
|
|
1804 @subsubsection Fancy Diary Display
|
|
1805 @vindex diary-display-hook
|
|
1806 @findex simple-diary-display
|
|
1807
|
|
1808 Diary display works by preparing the diary buffer and then running the
|
|
1809 hook @code{diary-display-hook}. The default value of this hook hides
|
|
1810 the irrelevant diary entries and then displays the buffer
|
|
1811 (@code{simple-diary-display}). However, if you specify the hook as
|
|
1812 follows,
|
|
1813
|
|
1814 @cindex diary buffer
|
|
1815 @findex fancy-diary-display
|
|
1816 @example
|
|
1817 (add-hook 'diary-display-hook 'fancy-diary-display)
|
|
1818 @end example
|
|
1819
|
|
1820 @noindent
|
|
1821 then fancy mode displays diary entries and holidays by copying them into
|
|
1822 a special buffer that exists only for display. Copying provides an
|
|
1823 opportunity to change the displayed text to make it prettier---for
|
|
1824 example, to sort the entries by the dates they apply to.
|
|
1825
|
|
1826 As with simple diary display, you can print a hard copy of the buffer
|
|
1827 with @code{print-diary-entries}. To print a hard copy of a day-by-day
|
|
1828 diary for a week by positioning point on Sunday of that week, type
|
|
1829 @kbd{7 d} and then do @kbd{M-x print-diary-entries}. As usual, the
|
|
1830 inclusion of the holidays slows down the display slightly; you can speed
|
|
1831 things up by setting the variable @code{holidays-in-diary-buffer} to
|
|
1832 @code{nil}.
|
|
1833
|
|
1834 @vindex diary-list-include-blanks
|
|
1835 Ordinarily, the fancy diary buffer does not show days for which there are
|
|
1836 no diary entries, even if that day is a holiday. If you want such days to be
|
|
1837 shown in the fancy diary buffer, set the variable
|
|
1838 @code{diary-list-include-blanks} to @code{t}.@refill
|
|
1839
|
|
1840 @cindex sorting diary entries
|
|
1841 If you use the fancy diary display, you can use the normal hook
|
|
1842 @code{list-diary-entries-hook} to sort each day's diary entries by their
|
|
1843 time of day. Add this line to your @file{.emacs} file:
|
|
1844
|
|
1845 @findex sort-diary-entries
|
|
1846 @example
|
|
1847 (add-hook 'list-diary-entries-hook 'sort-diary-entries)
|
|
1848 @end example
|
|
1849
|
|
1850 @noindent
|
|
1851 For each day, this sorts diary entries that begin with a recognizable
|
|
1852 time of day according to their times. Diary entries without times come
|
|
1853 first within each day.
|
|
1854
|
|
1855 @node Included Diary Files
|
|
1856 @subsubsection Included Diary Files
|
|
1857
|
|
1858 If you use the fancy diary display, you can have diary entries from other
|
|
1859 files included with your own by an ``include'' mechanism. This facility makes
|
|
1860 possible the sharing of common diary files among groups of users. Lines in
|
|
1861 the diary file of this form:
|
|
1862
|
|
1863 @smallexample
|
|
1864 #include "@var{filename}"
|
|
1865 @end smallexample
|
|
1866
|
|
1867 @noindent
|
|
1868 includes the diary entries from the file @var{filename} in the fancy
|
|
1869 diary buffer (because the ordinary diary buffer is just the buffer
|
|
1870 associated with your diary file, you cannot use the include mechanism
|
|
1871 unless you use the fancy diary buffer). The include mechanism is
|
|
1872 recursive, by the way, so that included files can include other files,
|
|
1873 and so on; you must be careful not to have a cycle of inclusions, of
|
|
1874 course. To enable the include facility, add lines as follows to your
|
|
1875 @file{.emacs} file:
|
|
1876
|
|
1877 @vindex list-diary-entries-hook
|
|
1878 @vindex mark-diary-entries-hook
|
|
1879 @findex include-other-diary-files
|
|
1880 @findex mark-included-diary-files
|
|
1881 @smallexample
|
|
1882 (add-hook 'list-diary-entries-hook 'include-other-diary-files)
|
|
1883 (add-hook 'mark-diary-entries-hook 'mark-included-diary-files)
|
|
1884 @end smallexample
|
|
1885
|
|
1886 @node Sexp Diary Entries
|
|
1887 @subsubsection Sexp Entries and the Fancy Diary Display
|
|
1888 @cindex sexp diary entries
|
|
1889
|
|
1890 Sexp diary entries allow you to do more than just have complicated
|
|
1891 conditions under which a diary entry applies. If you use the fancy
|
|
1892 diary display, sexp entries can generate the text of the entry depending
|
|
1893 on the date itself. For example, an anniversary diary entry can insert
|
|
1894 the number of years since the anniversary date into the text of the
|
|
1895 diary entry. Thus the @samp{%d} in this dairy entry:
|
|
1896
|
|
1897 @findex diary-anniversary
|
|
1898 @smallexample
|
|
1899 %%(diary-anniversary 10 31 1948) Arthur's birthday (%d years old)
|
|
1900 @end smallexample
|
|
1901
|
|
1902 @noindent
|
|
1903 gets replaced by the age, so on October 31, 1990 the entry appears in
|
|
1904 the fancy diary buffer like this:
|
|
1905
|
|
1906 @smallexample
|
|
1907 Arthur's birthday (42 years old)
|
|
1908 @end smallexample
|
|
1909
|
|
1910 @noindent
|
|
1911 If the diary file instead contains this entry:
|
|
1912
|
|
1913 @smallexample
|
|
1914 %%(diary-anniversary 10 31 1948) Arthur's %d%s birthday
|
|
1915 @end smallexample
|
|
1916
|
|
1917 @noindent
|
|
1918 the entry in the fancy diary buffer for October 31, 1990 appears like this:
|
|
1919
|
|
1920 @smallexample
|
|
1921 Arthur's 42nd birthday
|
|
1922 @end smallexample
|
|
1923
|
|
1924 Similarly, cyclic diary entries can interpolate the number of repetitions
|
|
1925 that have occurred:
|
|
1926
|
|
1927 @findex diary-cyclic
|
|
1928 @smallexample
|
|
1929 %%(diary-cyclic 50 1 1 1990) Renew medication (%d%s time)
|
|
1930 @end smallexample
|
|
1931
|
|
1932 @noindent
|
|
1933 looks like this:
|
|
1934
|
|
1935 @smallexample
|
|
1936 Renew medication (5th time)
|
|
1937 @end smallexample
|
|
1938
|
|
1939 @noindent
|
|
1940 in the fancy diary display on September 8, 1990.
|
|
1941
|
|
1942 The generality of sexp diary entries lets you specify any diary entry
|
|
1943 that you can describe algorithmically. Suppose you get paid on the 21st
|
|
1944 of the month if it is a weekday, and to the Friday before if the 21st is
|
|
1945 on a weekend. The diary entry
|
|
1946
|
|
1947 @smallexample
|
|
1948 &%%(let ((dayname (calendar-day-of-week date))
|
|
1949 (day (car (cdr date))))
|
|
1950 (or (and (= day 21) (memq dayname '(1 2 3 4 5)))
|
|
1951 (and (memq day '(19 20)) (= dayname 5)))
|
|
1952 ) Pay check deposited
|
|
1953 @end smallexample
|
|
1954
|
|
1955 @noindent
|
|
1956 applies to just those dates. This example illustrates how the sexp can
|
|
1957 depend on the variable @code{date}; this variable is a list (@var{month}
|
|
1958 @var{day} @var{year}) that gives the Gregorian date for which the diary
|
|
1959 entries are being found. If the value of the expression is @code{t},
|
|
1960 the entry applies to that date. If the expression evaluates to
|
|
1961 @code{nil}, the entry does @emph{not} apply to that date.
|
|
1962
|
|
1963 The following sexp diary entries take advantage of the ability (in the fancy
|
|
1964 diary display) to concoct diary entries based on the date:
|
|
1965
|
|
1966 @findex diary-sunrise-sunset
|
|
1967 @findex diary-phases-of-moon
|
|
1968 @findex diary-day-of-year
|
|
1969 @findex diary-iso-date
|
|
1970 @findex diary-julian-date
|
|
1971 @findex diary-astro-day-number
|
|
1972 @findex diary-hebrew-date
|
|
1973 @findex diary-islamic-date
|
|
1974 @findex diary-french-date
|
|
1975 @findex diary-mayan-date
|
|
1976 @table @code
|
|
1977 @item %%(diary-sunrise-sunset)
|
|
1978 Make a diary entry for the local times of today's sunrise and sunset.
|
|
1979 @item %%(diary-phases-of-moon)
|
|
1980 Make a diary entry for the phases (quarters) of the moon.
|
|
1981 @item %%(diary-day-of-year)
|
|
1982 Make a diary entry with today's day number in the current year and the number
|
|
1983 of days remaining in the current year.
|
|
1984 @item %%(diary-iso-date)
|
|
1985 Make a diary entry with today's equivalent ISO commercial date.
|
|
1986 @item %%(diary-julian-date)
|
|
1987 Make a diary entry with today's equivalent date on the Julian calendar.
|
|
1988 @item %%(diary-astro-day-number)
|
|
1989 Make a diary entry with today's equivalent astronomical (Julian) day number.
|
|
1990 @item %%(diary-hebrew-date)
|
|
1991 Make a diary entry with today's equivalent date on the Hebrew calendar.
|
|
1992 @item %%(diary-islamic-date)
|
|
1993 Make a diary entry with today's equivalent date on the Islamic calendar.
|
|
1994 @item %%(diary-french-date)
|
|
1995 Make a diary entry with today's equivalent date on the French Revolutionary
|
|
1996 calendar.
|
|
1997 @item %%(diary-mayan-date)
|
|
1998 Make a diary entry with today's equivalent date on the Mayan calendar.
|
|
1999 @end table
|
|
2000
|
|
2001 @noindent
|
|
2002 Thus including the diary entry
|
|
2003
|
|
2004 @smallexample
|
|
2005 &%%(diary-hebrew-date)
|
|
2006 @end smallexample
|
|
2007
|
|
2008 @noindent
|
|
2009 causes every day's diary display to contain the equivalent date on the
|
|
2010 Hebrew calendar, if you are using the fancy diary display. (With simple
|
|
2011 diary display, the line @samp{&%%(diary-hebrew-date)} appears in the
|
|
2012 diary for any date, but does nothing particularly useful.)
|
|
2013
|
|
2014 There are a number of other available sexp diary entries that are important
|
|
2015 to those who follow the Hebrew calendar:
|
|
2016
|
|
2017 @cindex rosh hodesh
|
|
2018 @findex diary-rosh-hodesh
|
|
2019 @cindex parasha, weekly
|
|
2020 @findex diary-parasha
|
|
2021 @cindex candle lighting times
|
|
2022 @findex diary-sabbath-candles
|
|
2023 @cindex omer count
|
|
2024 @findex diary-omer
|
|
2025 @cindex yahrzeits
|
|
2026 @findex diary-yahrzeit
|
|
2027 @table @code
|
|
2028 @item %%(diary-rosh-hodesh)
|
|
2029 Make a diary entry that tells the occurrence and ritual announcement of each
|
|
2030 new Hebrew month.
|
|
2031 @item %%(diary-parasha)
|
|
2032 Make a Saturday diary entry that tells the weekly synagogue scripture reading.
|
|
2033 @item %%(diary-sabbath-candles)
|
|
2034 Make a Friday diary entry that tells the @emph{local time} of Sabbath
|
|
2035 candle lighting.
|
|
2036 @item %%(diary-omer)
|
|
2037 Make a diary entry that gives the omer count, when appropriate.
|
|
2038 @item %%(diary-yahrzeit @var{month} @var{day} @var{year}) @var{name}
|
|
2039 Make a diary entry marking the anniversary of a date of death. The date
|
|
2040 is the @emph{Gregorian} (civil) date of death. The diary entry appears
|
|
2041 on the proper Hebrew calendar anniversary and on the day before. (In
|
|
2042 the European style, the order of the parameters is changed to @var{day},
|
|
2043 @var{month}, @var{year}.)
|
|
2044 @end table
|
|
2045
|
|
2046 @node Appt Customizing
|
|
2047 @subsubsection Customizing Appointment Reminders
|
|
2048
|
|
2049 You can specify exactly how Emacs reminds you of an appointment and
|
|
2050 how far in advance it begins doing so. Here are the variables that you
|
|
2051 can set:
|
|
2052
|
|
2053 @vindex appt-message-warning-time
|
|
2054 @vindex appt-audible
|
|
2055 @vindex appt-visible
|
|
2056 @vindex appt-display-mode-line
|
|
2057 @vindex appt-msg-window
|
|
2058 @vindex appt-display-duration
|
|
2059 @table @code
|
|
2060 @item appt-message-warning-time
|
|
2061 The time in minutes before an appointment that the reminder begins. The
|
|
2062 default is 10 minutes.
|
|
2063 @item appt-audible
|
|
2064 If this is @code{t} (the default), Emacs rings the terminal bell for
|
|
2065 appointment reminders.
|
|
2066 @item appt-visible
|
|
2067 If this is @code{t} (the default), Emacs displays the appointment
|
|
2068 message in echo area.
|
|
2069 @item appt-display-mode-line
|
|
2070 If this is @code{t} (the default), Emacs displays the number of minutes
|
|
2071 to the appointment on the mode line.
|
|
2072 @item appt-msg-window
|
|
2073 If this is @code{t} (the default), Emacs displays the appointment
|
|
2074 message in another window.
|
|
2075 @item appt-display-duration
|
|
2076 The number of seconds an appointment message is displayed. The default
|
|
2077 is 5 seconds.
|
|
2078 @end table
|