comparison man/xemacs/calendar.texi @ 298:70ad99077275 r21-0b47

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