aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2006-01-24 17:07:29 +0000
committerStefan Monnier2006-01-24 17:07:29 +0000
commit5d1c8151a3cc9b0089592a9f7bc1160e7396e68a (patch)
treee2c342bf9543df19523afb58da129177ae101c44
parent317921ec180582ce33123d71fcc1beb1fe33bd19 (diff)
downloademacs-5d1c8151a3cc9b0089592a9f7bc1160e7396e68a.tar.gz
emacs-5d1c8151a3cc9b0089592a9f7bc1160e7396e68a.zip
Remove unnecessary leading stars in docstrings.
(calendar-week-start-day): Add an :initializer. (calendar-mode-map): Use suppress-keymap, and command remapping. (describe-calendar-mode): Setup xref-stack info for the back button. (calendar-star-date): Insert before delete. (calendar-set-mode-line): Add file-modified info if applicable. (calendar-increment-month): New function.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/calendar/calendar.el530
2 files changed, 280 insertions, 260 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 93231f3ecee..dc427d5da7b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12006-01-24 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * calendar/calendar.el: Remove unnecessary leading stars in docstrings.
4 (calendar-week-start-day): Add an :initializer.
5 (calendar-mode-map): Use suppress-keymap, and command remapping.
6 (describe-calendar-mode): Setup xref-stack info for the back button.
7 (calendar-star-date): Insert before delete.
8 (calendar-set-mode-line): Add file-modified info if applicable.
9 (calendar-increment-month): New function.
10
12006-01-24 Tobias C. Rittweiler <tcr@freebits.de> (tiny change) 112006-01-24 Tobias C. Rittweiler <tcr@freebits.de> (tiny change)
2 12
3 * font-lock.el (lisp-font-lock-keywords-2): 13 * font-lock.el (lisp-font-lock-keywords-2):
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 1ef8d048c88..f01f4305708 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -1,7 +1,7 @@
1;;; calendar.el --- calendar functions 1;;; calendar.el --- calendar functions
2 2
3;; Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1997, 3;; Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1997,
4;; 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 4;; 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
5 5
6;; Author: Edward M. Reingold <reingold@cs.uiuc.edu> 6;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
7;; Maintainer: Glenn Morris <rgm@gnu.org> 7;; Maintainer: Glenn Morris <rgm@gnu.org>
@@ -98,11 +98,10 @@
98 98
99;;; Code: 99;;; Code:
100 100
101(eval-when-compile 101(defvar displayed-month)
102 (defvar displayed-month) 102(defvar displayed-year)
103 (defvar displayed-year) 103(defvar calendar-month-name-array)
104 (defvar calendar-month-name-array) 104(defvar calendar-starred-day)
105 (defvar calendar-starred-day))
106 105
107(defun calendar-version () 106(defun calendar-version ()
108 (interactive) 107 (interactive)
@@ -146,7 +145,7 @@
146 145
147;;;###autoload 146;;;###autoload
148(defcustom calendar-offset 0 147(defcustom calendar-offset 0
149 "*The offset of the principal month from the center of the calendar window. 148 "The offset of the principal month from the center of the calendar window.
1500 means the principal month is in the center (default), -1 means on the left, 1490 means the principal month is in the center (default), -1 means on the left,
151+1 means on the right. Larger (or smaller) values push the principal month off 150+1 means on the right. Larger (or smaller) values push the principal month off
152the screen." 151the screen."
@@ -155,7 +154,7 @@ the screen."
155 154
156;;;###autoload 155;;;###autoload
157(defcustom view-diary-entries-initially nil 156(defcustom view-diary-entries-initially nil
158 "*Non-nil means display current date's diary entries on entry to calendar. 157 "Non-nil means display current date's diary entries on entry to calendar.
159The diary is displayed in another window when the calendar is first displayed, 158The diary is displayed in another window when the calendar is first displayed,
160if the current date is visible. The number of days of diary entries displayed 159if the current date is visible. The number of days of diary entries displayed
161is governed by the variable `number-of-diary-entries'. This variable can 160is governed by the variable `number-of-diary-entries'. This variable can
@@ -165,14 +164,14 @@ be overridden by the value of `calendar-setup'."
165 164
166;;;###autoload 165;;;###autoload
167(defcustom mark-diary-entries-in-calendar nil 166(defcustom mark-diary-entries-in-calendar nil
168 "*Non-nil means mark dates with diary entries, in the calendar window. 167 "Non-nil means mark dates with diary entries, in the calendar window.
169The marking symbol is specified by the variable `diary-entry-marker'." 168The marking symbol is specified by the variable `diary-entry-marker'."
170 :type 'boolean 169 :type 'boolean
171 :group 'diary) 170 :group 'diary)
172 171
173;;;###autoload 172;;;###autoload
174(defcustom calendar-remove-frame-by-deleting nil 173(defcustom calendar-remove-frame-by-deleting nil
175 "*Determine how the calendar mode removes a frame no longer needed. 174 "Determine how the calendar mode removes a frame no longer needed.
176If nil, make an icon of the frame. If non-nil, delete the frame." 175If nil, make an icon of the frame. If non-nil, delete the frame."
177 :type 'boolean 176 :type 'boolean
178 :group 'view) 177 :group 'view)
@@ -224,7 +223,7 @@ If nil, make an icon of the frame. If non-nil, delete the frame."
224 (if (not (display-color-p)) 223 (if (not (display-color-p))
225 "+" 224 "+"
226 'diary) 225 'diary)
227 "*How to mark dates that have diary entries. 226 "How to mark dates that have diary entries.
228The value can be either a single-character string or a face." 227The value can be either a single-character string or a face."
229 :type '(choice string face) 228 :type '(choice string face)
230 :group 'diary) 229 :group 'diary)
@@ -233,7 +232,7 @@ The value can be either a single-character string or a face."
233 (if (not (display-color-p)) 232 (if (not (display-color-p))
234 "=" 233 "="
235 'calendar-today) 234 'calendar-today)
236 "*How to mark today's date in the calendar. 235 "How to mark today's date in the calendar.
237The value can be either a single-character string or a face. 236The value can be either a single-character string or a face.
238Marking today's date is done only if you set up `today-visible-calendar-hook' 237Marking today's date is done only if you set up `today-visible-calendar-hook'
239to request that." 238to request that."
@@ -244,14 +243,14 @@ to request that."
244 (if (not (display-color-p)) 243 (if (not (display-color-p))
245 "*" 244 "*"
246 'holiday) 245 'holiday)
247 "*How to mark notable dates in the calendar. 246 "How to mark notable dates in the calendar.
248The value can be either a single-character string or a face." 247The value can be either a single-character string or a face."
249 :type '(choice string face) 248 :type '(choice string face)
250 :group 'calendar) 249 :group 'calendar)
251 250
252;;;###autoload 251;;;###autoload
253(defcustom view-calendar-holidays-initially nil 252(defcustom view-calendar-holidays-initially nil
254 "*Non-nil means display holidays for current three month period on entry. 253 "Non-nil means display holidays for current three month period on entry.
255The holidays are displayed in another window when the calendar is first 254The holidays are displayed in another window when the calendar is first
256displayed." 255displayed."
257 :type 'boolean 256 :type 'boolean
@@ -259,14 +258,14 @@ displayed."
259 258
260;;;###autoload 259;;;###autoload
261(defcustom mark-holidays-in-calendar nil 260(defcustom mark-holidays-in-calendar nil
262 "*Non-nil means mark dates of holidays in the calendar window. 261 "Non-nil means mark dates of holidays in the calendar window.
263The marking symbol is specified by the variable `calendar-holiday-marker'." 262The marking symbol is specified by the variable `calendar-holiday-marker'."
264 :type 'boolean 263 :type 'boolean
265 :group 'holidays) 264 :group 'holidays)
266 265
267;;;###autoload 266;;;###autoload
268(defcustom all-hebrew-calendar-holidays nil 267(defcustom all-hebrew-calendar-holidays nil
269 "*If nil, show only major holidays from the Hebrew calendar. 268 "If nil, show only major holidays from the Hebrew calendar.
270This means only those Jewish holidays that appear on secular calendars. 269This means only those Jewish holidays that appear on secular calendars.
271 270
272If t, show all the holidays that would appear in a complete Hebrew calendar." 271If t, show all the holidays that would appear in a complete Hebrew calendar."
@@ -275,7 +274,7 @@ If t, show all the holidays that would appear in a complete Hebrew calendar."
275 274
276;;;###autoload 275;;;###autoload
277(defcustom all-christian-calendar-holidays nil 276(defcustom all-christian-calendar-holidays nil
278 "*If nil, show only major holidays from the Christian calendar. 277 "If nil, show only major holidays from the Christian calendar.
279This means only those Christian holidays that appear on secular calendars. 278This means only those Christian holidays that appear on secular calendars.
280 279
281If t, show all the holidays that would appear in a complete Christian 280If t, show all the holidays that would appear in a complete Christian
@@ -285,7 +284,7 @@ calendar."
285 284
286;;;###autoload 285;;;###autoload
287(defcustom all-islamic-calendar-holidays nil 286(defcustom all-islamic-calendar-holidays nil
288 "*If nil, show only major holidays from the Islamic calendar. 287 "If nil, show only major holidays from the Islamic calendar.
289This means only those Islamic holidays that appear on secular calendars. 288This means only those Islamic holidays that appear on secular calendars.
290 289
291If t, show all the holidays that would appear in a complete Islamic 290If t, show all the holidays that would appear in a complete Islamic
@@ -294,13 +293,13 @@ calendar."
294 :group 'holidays) 293 :group 'holidays)
295 294
296(defcustom diary-file-name-prefix-function (function (lambda (str) str)) 295(defcustom diary-file-name-prefix-function (function (lambda (str) str))
297 "*The function that will take a diary file name and return the desired prefix." 296 "The function that will take a diary file name and return the desired prefix."
298 :type 'function 297 :type 'function
299 :group 'diary) 298 :group 'diary)
300 299
301;;;###autoload 300;;;###autoload
302(defcustom all-bahai-calendar-holidays nil 301(defcustom all-bahai-calendar-holidays nil
303 "*If nil, show only major holidays from the Baha'i calendar. 302 "If nil, show only major holidays from the Baha'i calendar.
304These are the days on which work and school must be suspended. 303These are the days on which work and school must be suspended.
305 304
306If t, show all the holidays that would appear in a complete Baha'i 305If t, show all the holidays that would appear in a complete Baha'i
@@ -310,14 +309,14 @@ calendar."
310 309
311;;;###autoload 310;;;###autoload
312(defcustom calendar-load-hook nil 311(defcustom calendar-load-hook nil
313 "*List of functions to be called after the calendar is first loaded. 312 "List of functions to be called after the calendar is first loaded.
314This is the place to add key bindings to `calendar-mode-map'." 313This is the place to add key bindings to `calendar-mode-map'."
315 :type 'hook 314 :type 'hook
316 :group 'calendar-hooks) 315 :group 'calendar-hooks)
317 316
318;;;###autoload 317;;;###autoload
319(defcustom initial-calendar-window-hook nil 318(defcustom initial-calendar-window-hook nil
320 "*List of functions to be called when the calendar window is first opened. 319 "List of functions to be called when the calendar window is first opened.
321The functions invoked are called after the calendar window is opened, but 320The functions invoked are called after the calendar window is opened, but
322once opened is never called again. Leaving the calendar with the `q' command 321once opened is never called again. Leaving the calendar with the `q' command
323and reentering it will cause these functions to be called again." 322and reentering it will cause these functions to be called again."
@@ -326,7 +325,7 @@ and reentering it will cause these functions to be called again."
326 325
327;;;###autoload 326;;;###autoload
328(defcustom today-visible-calendar-hook nil 327(defcustom today-visible-calendar-hook nil
329 "*List of functions called whenever the current date is visible. 328 "List of functions called whenever the current date is visible.
330This can be used, for example, to replace today's date with asterisks; a 329This can be used, for example, to replace today's date with asterisks; a
331function `calendar-star-date' is included for this purpose: 330function `calendar-star-date' is included for this purpose:
332 (setq today-visible-calendar-hook 'calendar-star-date) 331 (setq today-visible-calendar-hook 'calendar-star-date)
@@ -346,7 +345,7 @@ functions that move by days and weeks."
346 345
347;;;###autoload 346;;;###autoload
348(defcustom today-invisible-calendar-hook nil 347(defcustom today-invisible-calendar-hook nil
349 "*List of functions called whenever the current date is not visible. 348 "List of functions called whenever the current date is not visible.
350 349
351The corresponding variable `today-visible-calendar-hook' is the list of 350The corresponding variable `today-visible-calendar-hook' is the list of
352functions called when the calendar function was called when the current 351functions called when the calendar function was called when the current
@@ -360,7 +359,7 @@ functions that move by days and weeks."
360 359
361;;;###autoload 360;;;###autoload
362(defcustom calendar-move-hook nil 361(defcustom calendar-move-hook nil
363 "*List of functions called whenever the cursor moves in the calendar. 362 "List of functions called whenever the cursor moves in the calendar.
364 363
365For example, 364For example,
366 365
@@ -372,7 +371,7 @@ redisplays the diary for whatever date the cursor is moved to."
372 371
373;;;###autoload 372;;;###autoload
374(defcustom diary-file "~/diary" 373(defcustom diary-file "~/diary"
375 "*Name of the file in which one's personal diary of dates is kept. 374 "Name of the file in which one's personal diary of dates is kept.
376 375
377The file's entries are lines beginning with any of the forms 376The file's entries are lines beginning with any of the forms
378specified by the variable `american-date-diary-pattern', by default: 377specified by the variable `american-date-diary-pattern', by default:
@@ -480,37 +479,37 @@ details, see the documentation for the variable `list-diary-entries-hook'."
480 479
481;;;###autoload 480;;;###autoload
482(defcustom diary-nonmarking-symbol "&" 481(defcustom diary-nonmarking-symbol "&"
483 "*Symbol indicating that a diary entry is not to be marked in the calendar." 482 "Symbol indicating that a diary entry is not to be marked in the calendar."
484 :type 'string 483 :type 'string
485 :group 'diary) 484 :group 'diary)
486 485
487;;;###autoload 486;;;###autoload
488(defcustom hebrew-diary-entry-symbol "H" 487(defcustom hebrew-diary-entry-symbol "H"
489 "*Symbol indicating a diary entry according to the Hebrew calendar." 488 "Symbol indicating a diary entry according to the Hebrew calendar."
490 :type 'string 489 :type 'string
491 :group 'diary) 490 :group 'diary)
492 491
493;;;###autoload 492;;;###autoload
494(defcustom islamic-diary-entry-symbol "I" 493(defcustom islamic-diary-entry-symbol "I"
495 "*Symbol indicating a diary entry according to the Islamic calendar." 494 "Symbol indicating a diary entry according to the Islamic calendar."
496 :type 'string 495 :type 'string
497 :group 'diary) 496 :group 'diary)
498 497
499;;;###autoload 498;;;###autoload
500(defcustom bahai-diary-entry-symbol "B" 499(defcustom bahai-diary-entry-symbol "B"
501 "*Symbol indicating a diary entry according to the Baha'i calendar." 500 "Symbol indicating a diary entry according to the Baha'i calendar."
502 :type 'string 501 :type 'string
503 :group 'diary) 502 :group 'diary)
504 503
505;;;###autoload 504;;;###autoload
506(defcustom diary-include-string "#include" 505(defcustom diary-include-string "#include"
507 "*The string indicating inclusion of another file of diary entries. 506 "The string indicating inclusion of another file of diary entries.
508See the documentation for the function `include-other-diary-files'." 507See the documentation for the function `include-other-diary-files'."
509 :type 'string 508 :type 'string
510 :group 'diary) 509 :group 'diary)
511 510
512(defcustom diary-glob-file-regexp-prefix "^\\#" 511(defcustom diary-glob-file-regexp-prefix "^\\#"
513 "*The regular expression that gets pre-pended to each of the attribute-regexp's for file-wide specifiers." 512 "The regular expression that gets pre-pended to each of the attribute-regexp's for file-wide specifiers."
514 :type 'regexp 513 :type 'regexp
515 :group 'diary) 514 :group 'diary)
516 515
@@ -531,7 +530,7 @@ See the documentation for the function `include-other-diary-files'."
531;;; (" *\\[box:\\([-a-z]+\\)\\]$" 1 :box) 530;;; (" *\\[box:\\([-a-z]+\\)\\]$" 1 :box)
532;;; (" *\\[stipple:\\([-a-z]+\\)\\]$" 1 :stipple) 531;;; (" *\\[stipple:\\([-a-z]+\\)\\]$" 1 :stipple)
533 ) 532 )
534 "*A list of (regexp regnum attr attrtype) lists where the 533 "A list of (regexp regnum attr attrtype) lists where the
535regexp says how to find the tag, the regnum says which 534regexp says how to find the tag, the regnum says which
536parenthetical sub-regexp this regexp looks for, and the attr says 535parenthetical sub-regexp this regexp looks for, and the attr says
537which attribute of the face (or that this _is_ a face) is being 536which attribute of the face (or that this _is_ a face) is being
@@ -546,14 +545,14 @@ modified."
546 545
547;;;###autoload 546;;;###autoload
548(defcustom sexp-diary-entry-symbol "%%" 547(defcustom sexp-diary-entry-symbol "%%"
549 "*The string used to indicate a sexp diary entry in `diary-file'. 548 "The string used to indicate a sexp diary entry in `diary-file'.
550See the documentation for the function `list-sexp-diary-entries'." 549See the documentation for the function `list-sexp-diary-entries'."
551 :type 'string 550 :type 'string
552 :group 'diary) 551 :group 'diary)
553 552
554;;;###autoload 553;;;###autoload
555(defcustom abbreviated-calendar-year t 554(defcustom abbreviated-calendar-year t
556 "*Interpret a two-digit year DD in a diary entry as either 19DD or 20DD. 555 "Interpret a two-digit year DD in a diary entry as either 19DD or 20DD.
557For the Gregorian calendar; similarly for the Hebrew, Islamic and 556For the Gregorian calendar; similarly for the Hebrew, Islamic and
558Baha'i calendars. If this variable is nil, years must be written in 557Baha'i calendars. If this variable is nil, years must be written in
559full." 558full."
@@ -562,7 +561,7 @@ full."
562 561
563;;;###autoload 562;;;###autoload
564(defcustom european-calendar-style nil 563(defcustom european-calendar-style nil
565 "*Use the European style of dates in the diary and in any displays. 564 "Use the European style of dates in the diary and in any displays.
566If this variable is t, a date 1/2/1990 would be interpreted as February 1, 565If this variable is t, a date 1/2/1990 would be interpreted as February 1,
5671990. The default European date styles (see `european-date-diary-pattern') 5661990. The default European date styles (see `european-date-diary-pattern')
568are 567are
@@ -589,7 +588,7 @@ are loaded. Otherwise, use one of the functions `european-calendar' or
589 (monthname " *" day "[^,0-9]") 588 (monthname " *" day "[^,0-9]")
590 (monthname " *" day ", *" year "[^0-9]") 589 (monthname " *" day ", *" year "[^0-9]")
591 (dayname "\\W")) 590 (dayname "\\W"))
592 "*List of pseudo-patterns describing the American patterns of date used. 591 "List of pseudo-patterns describing the American patterns of date used.
593See the documentation of `diary-date-forms' for an explanation." 592See the documentation of `diary-date-forms' for an explanation."
594 :type '(repeat (choice (cons :tag "Backup" 593 :type '(repeat (choice (cons :tag "Backup"
595 :value (backup . nil) 594 :value (backup . nil)
@@ -609,7 +608,7 @@ See the documentation of `diary-date-forms' for an explanation."
609 (backup day " *" monthname "\\W+\\<\\([^*0-9]\\|\\([0-9]+[:aApP]\\)\\)") 608 (backup day " *" monthname "\\W+\\<\\([^*0-9]\\|\\([0-9]+[:aApP]\\)\\)")
610 (day " *" monthname " *" year "[^0-9]") 609 (day " *" monthname " *" year "[^0-9]")
611 (dayname "\\W")) 610 (dayname "\\W"))
612 "*List of pseudo-patterns describing the European patterns of date used. 611 "List of pseudo-patterns describing the European patterns of date used.
613See the documentation of `diary-date-forms' for an explanation." 612See the documentation of `diary-date-forms' for an explanation."
614 :type '(repeat (choice (cons :tag "Backup" 613 :type '(repeat (choice (cons :tag "Backup"
615 :value (backup . nil) 614 :value (backup . nil)
@@ -626,7 +625,7 @@ See the documentation of `diary-date-forms' for an explanation."
626 (if european-calendar-style 625 (if european-calendar-style
627 european-date-diary-pattern 626 european-date-diary-pattern
628 american-date-diary-pattern) 627 american-date-diary-pattern)
629 "*List of pseudo-patterns describing the forms of date used in the diary. 628 "List of pseudo-patterns describing the forms of date used in the diary.
630The patterns on the list must be MUTUALLY EXCLUSIVE and should not match 629The patterns on the list must be MUTUALLY EXCLUSIVE and should not match
631any portion of the diary entry itself, just the date component. 630any portion of the diary entry itself, just the date component.
632 631
@@ -664,7 +663,7 @@ a portion of the first word of the diary entry."
664;;;###autoload 663;;;###autoload
665(defcustom european-calendar-display-form 664(defcustom european-calendar-display-form
666 '((if dayname (concat dayname ", ")) day " " monthname " " year) 665 '((if dayname (concat dayname ", ")) day " " monthname " " year)
667 "*Pseudo-pattern governing the way a date appears in the European style. 666 "Pseudo-pattern governing the way a date appears in the European style.
668See the documentation of `calendar-date-display-form' for an explanation." 667See the documentation of `calendar-date-display-form' for an explanation."
669 :type 'sexp 668 :type 'sexp
670 :group 'calendar) 669 :group 'calendar)
@@ -672,7 +671,7 @@ See the documentation of `calendar-date-display-form' for an explanation."
672;;;###autoload 671;;;###autoload
673(defcustom american-calendar-display-form 672(defcustom american-calendar-display-form
674 '((if dayname (concat dayname ", ")) monthname " " day ", " year) 673 '((if dayname (concat dayname ", ")) monthname " " day ", " year)
675 "*Pseudo-pattern governing the way a date appears in the American style. 674 "Pseudo-pattern governing the way a date appears in the American style.
676See the documentation of `calendar-date-display-form' for an explanation." 675See the documentation of `calendar-date-display-form' for an explanation."
677 :type 'sexp 676 :type 'sexp
678 :group 'calendar) 677 :group 'calendar)
@@ -681,7 +680,7 @@ See the documentation of `calendar-date-display-form' for an explanation."
681 (if european-calendar-style 680 (if european-calendar-style
682 european-calendar-display-form 681 european-calendar-display-form
683 american-calendar-display-form) 682 american-calendar-display-form)
684 "*Pseudo-pattern governing the way a date appears. 683 "Pseudo-pattern governing the way a date appears.
685 684
686Used by the function `calendar-date-string', a pseudo-pattern is a list of 685Used by the function `calendar-date-string', a pseudo-pattern is a list of
687expressions that can involve the keywords `month', `day', and `year', all 686expressions that can involve the keywords `month', `day', and `year', all
@@ -722,7 +721,7 @@ See the documentation of the function `calendar-date-string'."
722 721
723;;;###autoload 722;;;###autoload
724(defcustom print-diary-entries-hook 'lpr-buffer 723(defcustom print-diary-entries-hook 'lpr-buffer
725 "*List of functions called after a temporary diary buffer is prepared. 724 "List of functions called after a temporary diary buffer is prepared.
726The buffer shows only the diary entries currently visible in the diary 725The buffer shows only the diary entries currently visible in the diary
727buffer. The default just does the printing. Other uses might include, for 726buffer. The default just does the printing. Other uses might include, for
728example, rearranging the lines into order by day and time, saving the buffer 727example, rearranging the lines into order by day and time, saving the buffer
@@ -732,7 +731,7 @@ instead of deleting it, or changing the function used to do the printing."
732 731
733;;;###autoload 732;;;###autoload
734(defcustom list-diary-entries-hook nil 733(defcustom list-diary-entries-hook nil
735 "*List of functions called after diary file is culled for relevant entries. 734 "List of functions called after diary file is culled for relevant entries.
736It is to be used for diary entries that are not found in the diary file. 735It is to be used for diary entries that are not found in the diary file.
737 736
738A function `include-other-diary-files' is provided for use as the value of 737A function `include-other-diary-files' is provided for use as the value of
@@ -763,14 +762,14 @@ lexicographic order."
763 762
764;;;###autoload 763;;;###autoload
765(defcustom diary-hook nil 764(defcustom diary-hook nil
766 "*List of functions called after the display of the diary. 765 "List of functions called after the display of the diary.
767Can be used for appointment notification." 766Can be used for appointment notification."
768 :type 'hook 767 :type 'hook
769 :group 'diary) 768 :group 'diary)
770 769
771;;;###autoload 770;;;###autoload
772(defcustom diary-display-hook nil 771(defcustom diary-display-hook nil
773 "*List of functions that handle the display of the diary. 772 "List of functions that handle the display of the diary.
774If nil (the default), `simple-diary-display' is used. Use `ignore' for no 773If nil (the default), `simple-diary-display' is used. Use `ignore' for no
775diary display. 774diary display.
776 775
@@ -796,7 +795,7 @@ diary buffer, set the variable `diary-list-include-blanks' to t."
796 795
797;;;###autoload 796;;;###autoload
798(defcustom nongregorian-diary-listing-hook nil 797(defcustom nongregorian-diary-listing-hook nil
799 "*List of functions called for listing diary file and included files. 798 "List of functions called for listing diary file and included files.
800As the files are processed for diary entries, these functions are used 799As the files are processed for diary entries, these functions are used
801to cull relevant entries. You can use either or both of 800to cull relevant entries. You can use either or both of
802`list-hebrew-diary-entries', `list-islamic-diary-entries' and 801`list-hebrew-diary-entries', `list-islamic-diary-entries' and
@@ -810,7 +809,7 @@ describes the style of such diary entries."
810 809
811;;;###autoload 810;;;###autoload
812(defcustom mark-diary-entries-hook nil 811(defcustom mark-diary-entries-hook nil
813 "*List of functions called after marking diary entries in the calendar. 812 "List of functions called after marking diary entries in the calendar.
814 813
815A function `mark-included-diary-files' is also provided for use as the 814A function `mark-included-diary-files' is also provided for use as the
816`mark-diary-entries-hook'; it enables you to use shared diary files together 815`mark-diary-entries-hook'; it enables you to use shared diary files together
@@ -828,7 +827,7 @@ function `include-other-diary-files' as part of `list-diary-entries-hook'."
828 827
829;;;###autoload 828;;;###autoload
830(defcustom nongregorian-diary-marking-hook nil 829(defcustom nongregorian-diary-marking-hook nil
831 "*List of functions called for marking diary file and included files. 830 "List of functions called for marking diary file and included files.
832As the files are processed for diary entries, these functions are used 831As the files are processed for diary entries, these functions are used
833to cull relevant entries. You can use either or both of 832to cull relevant entries. You can use either or both of
834`mark-hebrew-diary-entries', `mark-islamic-diary-entries' and 833`mark-hebrew-diary-entries', `mark-islamic-diary-entries' and
@@ -842,7 +841,7 @@ describes the style of such diary entries."
842 841
843;;;###autoload 842;;;###autoload
844(defcustom diary-list-include-blanks nil 843(defcustom diary-list-include-blanks nil
845 "*If nil, do not include days with no diary entry in the list of diary entries. 844 "If nil, do not include days with no diary entry in the list of diary entries.
846Such days will then not be shown in the fancy diary buffer, even if they 845Such days will then not be shown in the fancy diary buffer, even if they
847are holidays." 846are holidays."
848 :type 'boolean 847 :type 'boolean
@@ -850,7 +849,7 @@ are holidays."
850 849
851;;;###autoload 850;;;###autoload
852(defcustom holidays-in-diary-buffer t 851(defcustom holidays-in-diary-buffer t
853 "*Non-nil means include holidays in the diary display. 852 "Non-nil means include holidays in the diary display.
854The holidays appear in the mode line of the diary buffer, or in the 853The holidays appear in the mode line of the diary buffer, or in the
855fancy diary buffer next to the date. This slows down the diary functions 854fancy diary buffer next to the date. This slows down the diary functions
856somewhat; setting it to nil makes the diary display faster." 855somewhat; setting it to nil makes the diary display faster."
@@ -880,7 +879,7 @@ somewhat; setting it to nil makes the diary display faster."
880 (holiday-fixed 10 31 "Halloween") 879 (holiday-fixed 10 31 "Halloween")
881 (holiday-fixed 11 11 "Veteran's Day") 880 (holiday-fixed 11 11 "Veteran's Day")
882 (holiday-float 11 4 4 "Thanksgiving")) 881 (holiday-float 11 4 4 "Thanksgiving"))
883 "*General holidays. Default value is for the United States. 882 "General holidays. Default value is for the United States.
884See the documentation for `calendar-holidays' for details." 883See the documentation for `calendar-holidays' for details."
885 :type 'sexp 884 :type 'sexp
886 :group 'holidays) 885 :group 'holidays)
@@ -891,7 +890,7 @@ See the documentation for `calendar-holidays' for details."
891(defcustom oriental-holidays 890(defcustom oriental-holidays
892 '((if (fboundp 'atan) 891 '((if (fboundp 'atan)
893 (holiday-chinese-new-year))) 892 (holiday-chinese-new-year)))
894 "*Oriental holidays. 893 "Oriental holidays.
895See the documentation for `calendar-holidays' for details." 894See the documentation for `calendar-holidays' for details."
896 :type 'sexp 895 :type 'sexp
897 :group 'holidays) 896 :group 'holidays)
@@ -900,7 +899,7 @@ See the documentation for `calendar-holidays' for details."
900(put 'local-holidays 'risky-local-variable t) 899(put 'local-holidays 'risky-local-variable t)
901;;;###autoload 900;;;###autoload
902(defcustom local-holidays nil 901(defcustom local-holidays nil
903 "*Local holidays. 902 "Local holidays.
904See the documentation for `calendar-holidays' for details." 903See the documentation for `calendar-holidays' for details."
905 :type 'sexp 904 :type 'sexp
906 :group 'holidays) 905 :group 'holidays)
@@ -909,7 +908,7 @@ See the documentation for `calendar-holidays' for details."
909(put 'other-holidays 'risky-local-variable t) 908(put 'other-holidays 'risky-local-variable t)
910;;;###autoload 909;;;###autoload
911(defcustom other-holidays nil 910(defcustom other-holidays nil
912 "*User defined holidays. 911 "User defined holidays.
913See the documentation for `calendar-holidays' for details." 912See the documentation for `calendar-holidays' for details."
914 :type 'sexp 913 :type 'sexp
915 :group 'holidays) 914 :group 'holidays)
@@ -1013,7 +1012,7 @@ See the documentation for `calendar-holidays' for details."
1013;;;###autoload 1012;;;###autoload
1014(defcustom hebrew-holidays (append hebrew-holidays-1 hebrew-holidays-2 1013(defcustom hebrew-holidays (append hebrew-holidays-1 hebrew-holidays-2
1015 hebrew-holidays-3 hebrew-holidays-4) 1014 hebrew-holidays-3 hebrew-holidays-4)
1016 "*Jewish holidays. 1015 "Jewish holidays.
1017See the documentation for `calendar-holidays' for details." 1016See the documentation for `calendar-holidays' for details."
1018 :type 'sexp 1017 :type 'sexp
1019 :group 'holidays) 1018 :group 'holidays)
@@ -1064,7 +1063,7 @@ See the documentation for `calendar-holidays' for details."
1064 (holiday-fixed 12 25 "Christmas") 1063 (holiday-fixed 12 25 "Christmas")
1065 (if all-christian-calendar-holidays 1064 (if all-christian-calendar-holidays
1066 (holiday-julian 12 25 "Eastern Orthodox Christmas"))) 1065 (holiday-julian 12 25 "Eastern Orthodox Christmas")))
1067 "*Christian holidays. 1066 "Christian holidays.
1068See the documentation for `calendar-holidays' for details." 1067See the documentation for `calendar-holidays' for details."
1069 :type 'sexp 1068 :type 'sexp
1070 :group 'holidays) 1069 :group 'holidays)
@@ -1099,7 +1098,7 @@ See the documentation for `calendar-holidays' for details."
1099 (holiday-islamic 10 1 "Id-al-Fitr")) 1098 (holiday-islamic 10 1 "Id-al-Fitr"))
1100 (if all-islamic-calendar-holidays 1099 (if all-islamic-calendar-holidays
1101 (holiday-islamic 12 10 "Id-al-Adha"))) 1100 (holiday-islamic 12 10 "Id-al-Adha")))
1102 "*Islamic holidays. 1101 "Islamic holidays.
1103See the documentation for `calendar-holidays' for details." 1102See the documentation for `calendar-holidays' for details."
1104 :type 'sexp 1103 :type 'sexp
1105 :group 'holidays) 1104 :group 'holidays)
@@ -1141,7 +1140,7 @@ See the documentation for `calendar-holidays' for details."
1141 (holiday-fixed 11 26 "Day of the Covenant")) 1140 (holiday-fixed 11 26 "Day of the Covenant"))
1142 (if all-bahai-calendar-holidays 1141 (if all-bahai-calendar-holidays
1143 (holiday-fixed 11 28 "Ascension of `Abdu'l-Baha"))) 1142 (holiday-fixed 11 28 "Ascension of `Abdu'l-Baha")))
1144 "*Baha'i holidays. 1143 "Baha'i holidays.
1145See the documentation for `calendar-holidays' for details." 1144See the documentation for `calendar-holidays' for details."
1146 :type 'sexp 1145 :type 'sexp
1147 :group 'holidays) 1146 :group 'holidays)
@@ -1173,7 +1172,7 @@ See the documentation for `calendar-holidays' for details."
1173 (/ calendar-daylight-savings-ends-time (float 60)) 1172 (/ calendar-daylight-savings-ends-time (float 60))
1174 calendar-daylight-time-zone-name) 1173 calendar-daylight-time-zone-name)
1175 "")))) 1174 ""))))
1176 "*Sun-related holidays. 1175 "Sun-related holidays.
1177See the documentation for `calendar-holidays' for details." 1176See the documentation for `calendar-holidays' for details."
1178 :type 'sexp 1177 :type 'sexp
1179 :group 'holidays) 1178 :group 'holidays)
@@ -1184,7 +1183,7 @@ See the documentation for `calendar-holidays' for details."
1184 (append general-holidays local-holidays other-holidays 1183 (append general-holidays local-holidays other-holidays
1185 christian-holidays hebrew-holidays islamic-holidays 1184 christian-holidays hebrew-holidays islamic-holidays
1186 bahai-holidays oriental-holidays solar-holidays) 1185 bahai-holidays oriental-holidays solar-holidays)
1187 "*List of notable days for the command \\[holidays]. 1186 "List of notable days for the command \\[holidays].
1188 1187
1189Additional holidays are easy to add to the list, just put them in the 1188Additional holidays are easy to add to the list, just put them in the
1190list `other-holidays' in your .emacs file. Similarly, by setting any 1189list `other-holidays' in your .emacs file. Similarly, by setting any
@@ -1304,6 +1303,15 @@ A negative YR is interpreted as BC; -1 being 1 BC, and so on."
1304 (and (< macro-y 0) (> ,mon 1) (setq ,yr (1- ,yr))) 1303 (and (< macro-y 0) (> ,mon 1) (setq ,yr (1- ,yr)))
1305 (if (< ,yr 1) (setq ,yr (1- ,yr))))) ; 0 AD -> -1 BC, etc 1304 (if (< ,yr 1) (setq ,yr (1- ,yr))))) ; 0 AD -> -1 BC, etc
1306 1305
1306(defun calendar-increment-month (n &optional mon yr)
1307 "Return the Nth month after MON/YR.
1308The return value is a pair (MONTH . YEAR).
1309MON defaults to `displayed-month'. YR defaults to `displayed-year'."
1310 (unless mon (setq mon displayed-month))
1311 (unless yr (setq mon displayed-year))
1312 (increment-calendar-month mon yr n)
1313 (cons mon yr))
1314
1307(defmacro calendar-for-loop (var from init to final do &rest body) 1315(defmacro calendar-for-loop (var from init to final do &rest body)
1308 "Execute a for loop." 1316 "Execute a for loop."
1309 (declare (debug (symbolp "from" form "to" form "do" body))) 1317 (declare (debug (symbolp "from" form "to" form "do" body)))
@@ -1313,6 +1321,7 @@ A negative YR is interpreted as BC; -1 being 1 BC, and so on."
1313 1321
1314(defmacro calendar-sum (index initial condition expression) 1322(defmacro calendar-sum (index initial condition expression)
1315 "For INDEX = INITIAL et seq, as long as CONDITION holds, sum EXPRESSION." 1323 "For INDEX = INITIAL et seq, as long as CONDITION holds, sum EXPRESSION."
1324 (declare (debug (symbolp form form form)))
1316 `(let ((,index ,initial) 1325 `(let ((,index ,initial)
1317 (sum 0)) 1326 (sum 0))
1318 (while ,condition 1327 (while ,condition
@@ -2140,7 +2149,7 @@ the inserted text. Value is always t."
2140 2149
2141;;;###autoload 2150;;;###autoload
2142(defcustom calendar-week-start-day 0 2151(defcustom calendar-week-start-day 0
2143 "*The day of the week on which a week in the calendar begins. 2152 "The day of the week on which a week in the calendar begins.
21440 means Sunday (default), 1 means Monday, and so on. 21530 means Sunday (default), 1 means Monday, and so on.
2145 2154
2146If you change this variable directly (without using customize) 2155If you change this variable directly (without using customize)
@@ -2148,160 +2157,159 @@ after starting `calendar', you should call `redraw-calendar' to
2148update the calendar display to reflect the change, otherwise 2157update the calendar display to reflect the change, otherwise
2149movement commands will not work correctly." 2158movement commands will not work correctly."
2150 :type 'integer 2159 :type 'integer
2160 ;; Change the initialize so that if you reload calendar.el, it will not
2161 ;; cause a redraw (which may fail, e.g. with "invalid byte-code in
2162 ;; calendar.elc" because of the "byte-compile-dynamic").
2163 :initialize 'custom-initialize-default
2151 :set (lambda (sym val) 2164 :set (lambda (sym val)
2152 (set sym val) 2165 (set sym val)
2153 (redraw-calendar)) 2166 (redraw-calendar))
2154 :group 'calendar) 2167 :group 'calendar)
2155 2168
2156(defcustom calendar-debug-sexp nil 2169(defcustom calendar-debug-sexp nil
2157 "*Turn debugging on when evaluating a sexp in the diary or holiday list." 2170 "Turn debugging on when evaluating a sexp in the diary or holiday list."
2158 :type 'boolean 2171 :type 'boolean
2159 :group 'calendar) 2172 :group 'calendar)
2160 2173
2161(defvar calendar-mode-map nil) 2174(defvar calendar-mode-map nil)
2162(if calendar-mode-map 2175(if calendar-mode-map
2163 nil 2176 nil
2164 (setq calendar-mode-map (make-sparse-keymap)) 2177 (let ((map (make-keymap)))
2165 (require 'cal-menu) 2178 (suppress-keymap map)
2166 (calendar-for-loop i from 0 to 9 do 2179 (dolist (c '(narrow-to-region mark-word mark-sexp mark-paragraph
2167 (define-key calendar-mode-map (int-to-string i) 'digit-argument)) 2180 mark-defun mark-whole-buffer mark-page
2168 (let ((l (list 'narrow-to-region 'mark-word 'mark-sexp 'mark-paragraph 2181 downcase-region upcase-region kill-region
2169 'mark-defun 'mark-whole-buffer 'mark-page 2182 copy-region-as-kill capitalize-region write-region))
2170 'downcase-region 'upcase-region 'kill-region 2183 (define-key map (vector 'remap c) 'calendar-not-implemented))
2171 'copy-region-as-kill 'capitalize-region 'write-region))) 2184 (define-key map ">" 'scroll-calendar-right)
2172 (while l 2185 (define-key map "\C-x>" 'scroll-calendar-right)
2173 (substitute-key-definition (car l) 'calendar-not-implemented 2186 (define-key map [prior] 'scroll-calendar-right-three-months)
2174 calendar-mode-map global-map) 2187 (define-key map "\ev" 'scroll-calendar-right-three-months)
2175 (setq l (cdr l)))) 2188 (define-key map "<" 'scroll-calendar-left)
2176 (define-key calendar-mode-map "-" 'negative-argument) 2189 (define-key map "\C-x<" 'scroll-calendar-left)
2177 (define-key calendar-mode-map ">" 'scroll-calendar-right) 2190 (define-key map [next] 'scroll-calendar-left-three-months)
2178 (define-key calendar-mode-map "\C-x>" 'scroll-calendar-right) 2191 (define-key map "\C-v" 'scroll-calendar-left-three-months)
2179 (define-key calendar-mode-map [prior] 'scroll-calendar-right-three-months) 2192 (define-key map "\C-b" 'calendar-backward-day)
2180 (define-key calendar-mode-map "\ev" 'scroll-calendar-right-three-months) 2193 (define-key map "\C-p" 'calendar-backward-week)
2181 (define-key calendar-mode-map "<" 'scroll-calendar-left) 2194 (define-key map "\e{" 'calendar-backward-month)
2182 (define-key calendar-mode-map "\C-x<" 'scroll-calendar-left) 2195 (define-key map "\C-x[" 'calendar-backward-year)
2183 (define-key calendar-mode-map [next] 'scroll-calendar-left-three-months) 2196 (define-key map "\C-f" 'calendar-forward-day)
2184 (define-key calendar-mode-map "\C-v" 'scroll-calendar-left-three-months) 2197 (define-key map "\C-n" 'calendar-forward-week)
2185 (define-key calendar-mode-map "\C-b" 'calendar-backward-day) 2198 (define-key map [left] 'calendar-backward-day)
2186 (define-key calendar-mode-map "\C-p" 'calendar-backward-week) 2199 (define-key map [up] 'calendar-backward-week)
2187 (define-key calendar-mode-map "\e{" 'calendar-backward-month) 2200 (define-key map [right] 'calendar-forward-day)
2188 (define-key calendar-mode-map "\C-x[" 'calendar-backward-year) 2201 (define-key map [down] 'calendar-forward-week)
2189 (define-key calendar-mode-map "\C-f" 'calendar-forward-day) 2202 (define-key map "\e}" 'calendar-forward-month)
2190 (define-key calendar-mode-map "\C-n" 'calendar-forward-week) 2203 (define-key map "\C-x]" 'calendar-forward-year)
2191 (define-key calendar-mode-map [left] 'calendar-backward-day) 2204 (define-key map "\C-a" 'calendar-beginning-of-week)
2192 (define-key calendar-mode-map [up] 'calendar-backward-week) 2205 (define-key map "\C-e" 'calendar-end-of-week)
2193 (define-key calendar-mode-map [right] 'calendar-forward-day) 2206 (define-key map "\ea" 'calendar-beginning-of-month)
2194 (define-key calendar-mode-map [down] 'calendar-forward-week) 2207 (define-key map "\ee" 'calendar-end-of-month)
2195 (define-key calendar-mode-map "\e}" 'calendar-forward-month) 2208 (define-key map "\e<" 'calendar-beginning-of-year)
2196 (define-key calendar-mode-map "\C-x]" 'calendar-forward-year) 2209 (define-key map "\e>" 'calendar-end-of-year)
2197 (define-key calendar-mode-map "\C-a" 'calendar-beginning-of-week) 2210 (define-key map "\C-@" 'calendar-set-mark)
2198 (define-key calendar-mode-map "\C-e" 'calendar-end-of-week) 2211 ;; Many people are used to typing C-SPC and getting C-@.
2199 (define-key calendar-mode-map "\ea" 'calendar-beginning-of-month) 2212 (define-key map [?\C- ] 'calendar-set-mark)
2200 (define-key calendar-mode-map "\ee" 'calendar-end-of-month) 2213 (define-key map "\C-x\C-x" 'calendar-exchange-point-and-mark)
2201 (define-key calendar-mode-map "\e<" 'calendar-beginning-of-year) 2214 (define-key map "\e=" 'calendar-count-days-region)
2202 (define-key calendar-mode-map "\e>" 'calendar-end-of-year) 2215 (define-key map "gd" 'calendar-goto-date)
2203 (define-key calendar-mode-map "\C-@" 'calendar-set-mark) 2216 (define-key map "gD" 'calendar-goto-day-of-year)
2204 ;; Many people are used to typing C-SPC and getting C-@. 2217 (define-key map "gj" 'calendar-goto-julian-date)
2205 (define-key calendar-mode-map [?\C- ] 'calendar-set-mark) 2218 (define-key map "ga" 'calendar-goto-astro-day-number)
2206 (define-key calendar-mode-map "\C-x\C-x" 'calendar-exchange-point-and-mark) 2219 (define-key map "gh" 'calendar-goto-hebrew-date)
2207 (define-key calendar-mode-map "\e=" 'calendar-count-days-region) 2220 (define-key map "gi" 'calendar-goto-islamic-date)
2208 (define-key calendar-mode-map "gd" 'calendar-goto-date) 2221 (define-key map "gb" 'calendar-goto-bahai-date)
2209 (define-key calendar-mode-map "gD" 'calendar-goto-day-of-year) 2222 (define-key map "gC" 'calendar-goto-chinese-date)
2210 (define-key calendar-mode-map "gj" 'calendar-goto-julian-date) 2223 (define-key map "gk" 'calendar-goto-coptic-date)
2211 (define-key calendar-mode-map "ga" 'calendar-goto-astro-day-number) 2224 (define-key map "ge" 'calendar-goto-ethiopic-date)
2212 (define-key calendar-mode-map "gh" 'calendar-goto-hebrew-date) 2225 (define-key map "gp" 'calendar-goto-persian-date)
2213 (define-key calendar-mode-map "gi" 'calendar-goto-islamic-date) 2226 (define-key map "gc" 'calendar-goto-iso-date)
2214 (define-key calendar-mode-map "gb" 'calendar-goto-bahai-date) 2227 (define-key map "gw" 'calendar-goto-iso-week)
2215 (define-key calendar-mode-map "gC" 'calendar-goto-chinese-date) 2228 (define-key map "gf" 'calendar-goto-french-date)
2216 (define-key calendar-mode-map "gk" 'calendar-goto-coptic-date) 2229 (define-key map "gml" 'calendar-goto-mayan-long-count-date)
2217 (define-key calendar-mode-map "ge" 'calendar-goto-ethiopic-date) 2230 (define-key map "gmpc" 'calendar-previous-calendar-round-date)
2218 (define-key calendar-mode-map "gp" 'calendar-goto-persian-date) 2231 (define-key map "gmnc" 'calendar-next-calendar-round-date)
2219 (define-key calendar-mode-map "gc" 'calendar-goto-iso-date) 2232 (define-key map "gmph" 'calendar-previous-haab-date)
2220 (define-key calendar-mode-map "gw" 'calendar-goto-iso-week) 2233 (define-key map "gmnh" 'calendar-next-haab-date)
2221 (define-key calendar-mode-map "gf" 'calendar-goto-french-date) 2234 (define-key map "gmpt" 'calendar-previous-tzolkin-date)
2222 (define-key calendar-mode-map "gml" 'calendar-goto-mayan-long-count-date) 2235 (define-key map "gmnt" 'calendar-next-tzolkin-date)
2223 (define-key calendar-mode-map "gmpc" 'calendar-previous-calendar-round-date) 2236 (define-key map "Aa" 'appt-add)
2224 (define-key calendar-mode-map "gmnc" 'calendar-next-calendar-round-date) 2237 (define-key map "Ad" 'appt-delete)
2225 (define-key calendar-mode-map "gmph" 'calendar-previous-haab-date) 2238 (define-key map "S" 'calendar-sunrise-sunset)
2226 (define-key calendar-mode-map "gmnh" 'calendar-next-haab-date) 2239 (define-key map "M" 'calendar-phases-of-moon)
2227 (define-key calendar-mode-map "gmpt" 'calendar-previous-tzolkin-date) 2240 (define-key map " " 'scroll-other-window)
2228 (define-key calendar-mode-map "gmnt" 'calendar-next-tzolkin-date) 2241 (define-key map (kbd "DEL") 'scroll-other-window-down)
2229 (define-key calendar-mode-map "Aa" 'appt-add) 2242 (define-key map "\C-c\C-l" 'redraw-calendar)
2230 (define-key calendar-mode-map "Ad" 'appt-delete) 2243 (define-key map "." 'calendar-goto-today)
2231 (define-key calendar-mode-map "S" 'calendar-sunrise-sunset) 2244 (define-key map "o" 'calendar-other-month)
2232 (define-key calendar-mode-map "M" 'calendar-phases-of-moon) 2245 (define-key map "q" 'exit-calendar)
2233 (define-key calendar-mode-map " " 'scroll-other-window) 2246 (define-key map "a" 'list-calendar-holidays)
2234 (define-key calendar-mode-map (kbd "DEL") 'scroll-other-window-down) 2247 (define-key map "h" 'calendar-cursor-holidays)
2235 (define-key calendar-mode-map "\C-c\C-l" 'redraw-calendar) 2248 (define-key map "x" 'mark-calendar-holidays)
2236 (define-key calendar-mode-map "." 'calendar-goto-today) 2249 (define-key map "u" 'calendar-unmark)
2237 (define-key calendar-mode-map "o" 'calendar-other-month) 2250 (define-key map "m" 'mark-diary-entries)
2238 (define-key calendar-mode-map "q" 'exit-calendar) 2251 (define-key map "d" 'diary-view-entries)
2239 (define-key calendar-mode-map "a" 'list-calendar-holidays) 2252 (define-key map "D" 'view-other-diary-entries)
2240 (define-key calendar-mode-map "h" 'calendar-cursor-holidays) 2253 (define-key map "s" 'show-all-diary-entries)
2241 (define-key calendar-mode-map "x" 'mark-calendar-holidays) 2254 (define-key map "pd" 'calendar-print-day-of-year)
2242 (define-key calendar-mode-map "u" 'calendar-unmark) 2255 (define-key map "pC" 'calendar-print-chinese-date)
2243 (define-key calendar-mode-map "m" 'mark-diary-entries) 2256 (define-key map "pk" 'calendar-print-coptic-date)
2244 (define-key calendar-mode-map "d" 'diary-view-entries) 2257 (define-key map "pe" 'calendar-print-ethiopic-date)
2245 (define-key calendar-mode-map "D" 'view-other-diary-entries) 2258 (define-key map "pp" 'calendar-print-persian-date)
2246 (define-key calendar-mode-map "s" 'show-all-diary-entries) 2259 (define-key map "pc" 'calendar-print-iso-date)
2247 (define-key calendar-mode-map "pd" 'calendar-print-day-of-year) 2260 (define-key map "pj" 'calendar-print-julian-date)
2248 (define-key calendar-mode-map "pC" 'calendar-print-chinese-date) 2261 (define-key map "pa" 'calendar-print-astro-day-number)
2249 (define-key calendar-mode-map "pk" 'calendar-print-coptic-date) 2262 (define-key map "ph" 'calendar-print-hebrew-date)
2250 (define-key calendar-mode-map "pe" 'calendar-print-ethiopic-date) 2263 (define-key map "pi" 'calendar-print-islamic-date)
2251 (define-key calendar-mode-map "pp" 'calendar-print-persian-date) 2264 (define-key map "pb" 'calendar-print-bahai-date)
2252 (define-key calendar-mode-map "pc" 'calendar-print-iso-date) 2265 (define-key map "pf" 'calendar-print-french-date)
2253 (define-key calendar-mode-map "pj" 'calendar-print-julian-date) 2266 (define-key map "pm" 'calendar-print-mayan-date)
2254 (define-key calendar-mode-map "pa" 'calendar-print-astro-day-number) 2267 (define-key map "po" 'calendar-print-other-dates)
2255 (define-key calendar-mode-map "ph" 'calendar-print-hebrew-date) 2268 (define-key map "id" 'insert-diary-entry)
2256 (define-key calendar-mode-map "pi" 'calendar-print-islamic-date) 2269 (define-key map "iw" 'insert-weekly-diary-entry)
2257 (define-key calendar-mode-map "pb" 'calendar-print-bahai-date) 2270 (define-key map "im" 'insert-monthly-diary-entry)
2258 (define-key calendar-mode-map "pf" 'calendar-print-french-date) 2271 (define-key map "iy" 'insert-yearly-diary-entry)
2259 (define-key calendar-mode-map "pm" 'calendar-print-mayan-date) 2272 (define-key map "ia" 'insert-anniversary-diary-entry)
2260 (define-key calendar-mode-map "po" 'calendar-print-other-dates) 2273 (define-key map "ib" 'insert-block-diary-entry)
2261 (define-key calendar-mode-map "id" 'insert-diary-entry) 2274 (define-key map "ic" 'insert-cyclic-diary-entry)
2262 (define-key calendar-mode-map "iw" 'insert-weekly-diary-entry) 2275 (define-key map "ihd" 'insert-hebrew-diary-entry)
2263 (define-key calendar-mode-map "im" 'insert-monthly-diary-entry) 2276 (define-key map "ihm" 'insert-monthly-hebrew-diary-entry)
2264 (define-key calendar-mode-map "iy" 'insert-yearly-diary-entry) 2277 (define-key map "ihy" 'insert-yearly-hebrew-diary-entry)
2265 (define-key calendar-mode-map "ia" 'insert-anniversary-diary-entry) 2278 (define-key map "iid" 'insert-islamic-diary-entry)
2266 (define-key calendar-mode-map "ib" 'insert-block-diary-entry) 2279 (define-key map "iim" 'insert-monthly-islamic-diary-entry)
2267 (define-key calendar-mode-map "ic" 'insert-cyclic-diary-entry) 2280 (define-key map "iiy" 'insert-yearly-islamic-diary-entry)
2268 (define-key calendar-mode-map "ihd" 'insert-hebrew-diary-entry) 2281 (define-key map "iBd" 'insert-bahai-diary-entry)
2269 (define-key calendar-mode-map "ihm" 'insert-monthly-hebrew-diary-entry) 2282 (define-key map "iBm" 'insert-monthly-bahai-diary-entry)
2270 (define-key calendar-mode-map "ihy" 'insert-yearly-hebrew-diary-entry) 2283 (define-key map "iBy" 'insert-yearly-bahai-diary-entry)
2271 (define-key calendar-mode-map "iid" 'insert-islamic-diary-entry) 2284 (define-key map "?" 'calendar-goto-info-node)
2272 (define-key calendar-mode-map "iim" 'insert-monthly-islamic-diary-entry) 2285 (define-key map "tm" 'cal-tex-cursor-month)
2273 (define-key calendar-mode-map "iiy" 'insert-yearly-islamic-diary-entry) 2286 (define-key map "tM" 'cal-tex-cursor-month-landscape)
2274 (define-key calendar-mode-map "iBd" 'insert-bahai-diary-entry) 2287 (define-key map "td" 'cal-tex-cursor-day)
2275 (define-key calendar-mode-map "iBm" 'insert-monthly-bahai-diary-entry) 2288 (define-key map "tw1" 'cal-tex-cursor-week)
2276 (define-key calendar-mode-map "iBy" 'insert-yearly-bahai-diary-entry) 2289 (define-key map "tw2" 'cal-tex-cursor-week2)
2277 (define-key calendar-mode-map "?" 'calendar-goto-info-node) 2290 (define-key map "tw3" 'cal-tex-cursor-week-iso)
2278 (define-key calendar-mode-map "tm" 'cal-tex-cursor-month) 2291 (define-key map "tw4" 'cal-tex-cursor-week-monday)
2279 (define-key calendar-mode-map "tM" 'cal-tex-cursor-month-landscape) 2292 (define-key map "tfd" 'cal-tex-cursor-filofax-daily)
2280 (define-key calendar-mode-map "td" 'cal-tex-cursor-day) 2293 (define-key map "tfw" 'cal-tex-cursor-filofax-2week)
2281 (define-key calendar-mode-map "tw1" 'cal-tex-cursor-week) 2294 (define-key map "tfW" 'cal-tex-cursor-filofax-week)
2282 (define-key calendar-mode-map "tw2" 'cal-tex-cursor-week2) 2295 (define-key map "tfy" 'cal-tex-cursor-filofax-year)
2283 (define-key calendar-mode-map "tw3" 'cal-tex-cursor-week-iso) 2296 (define-key map "ty" 'cal-tex-cursor-year)
2284 (define-key calendar-mode-map "tw4" 'cal-tex-cursor-week-monday) 2297 (define-key map "tY" 'cal-tex-cursor-year-landscape)
2285 (define-key calendar-mode-map "tfd" 'cal-tex-cursor-filofax-daily) 2298 (setq calendar-mode-map map)
2286 (define-key calendar-mode-map "tfw" 'cal-tex-cursor-filofax-2week) 2299 ;; Require cal-menu after initializing calendar-mode-map because it uses it.
2287 (define-key calendar-mode-map "tfW" 'cal-tex-cursor-filofax-week) 2300 (require 'cal-menu)))
2288 (define-key calendar-mode-map "tfy" 'cal-tex-cursor-filofax-year)
2289 (define-key calendar-mode-map "ty" 'cal-tex-cursor-year)
2290 (define-key calendar-mode-map "tY" 'cal-tex-cursor-year-landscape))
2291 2301
2292(defun describe-calendar-mode () 2302(defun describe-calendar-mode ()
2293 "Create a help buffer with a brief description of the `calendar-mode'." 2303 "Create a help buffer with a brief description of the `calendar-mode'."
2294 (interactive) 2304 (interactive)
2295 (with-output-to-temp-buffer "*Help*" 2305 (help-setup-xref (list #'describe-calendar-mode) (interactive-p))
2306 (with-output-to-temp-buffer (help-buffer)
2296 (princ 2307 (princ
2297 (format 2308 (format
2298 "Calendar Mode:\nFor a complete description, type %s\n%s\n" 2309 "Calendar Mode:\nFor a complete description, type %s\n%s\n"
2299 (substitute-command-keys 2310 (substitute-command-keys
2300 "\\<calendar-mode-map>\\[describe-mode] from within the calendar") 2311 "\\<calendar-mode-map>\\[describe-mode] from within the calendar")
2301 (substitute-command-keys "\\{calendar-mode-map}"))) 2312 (substitute-command-keys "\\{calendar-mode-map}")))
2302 (save-excursion
2303 (set-buffer standard-output)
2304 (help-mode))
2305 (print-help-return-message))) 2313 (print-help-return-message)))
2306 2314
2307;; Calendar mode is suitable only for specially formatted data. 2315;; Calendar mode is suitable only for specially formatted data.
@@ -2451,12 +2459,11 @@ the STRINGS are just concatenated and the result truncated."
2451 (s (car strings)) 2459 (s (car strings))
2452 (strings (cdr strings)) 2460 (strings (cdr strings))
2453 (i 0)) 2461 (i 0))
2454 (while strings 2462 (dolist (string strings)
2455 (setq s (concat s 2463 (setq s (concat s
2456 (make-string (max 0 (/ (+ n i) m)) char) 2464 (make-string (max 0 (/ (+ n i) m)) char)
2457 (car strings))) 2465 string))
2458 (setq i (1+ i)) 2466 (setq i (1+ i)))
2459 (setq strings (cdr strings)))
2460 (substring s 0 length))) 2467 (substring s 0 length)))
2461 2468
2462(defun update-calendar-mode-line () 2469(defun update-calendar-mode-line ()
@@ -2478,7 +2485,7 @@ the STRINGS are just concatenated and the result truncated."
2478 list) 2485 list)
2479 (walk-windows (lambda (w) 2486 (walk-windows (lambda (w)
2480 (if (memq (window-buffer w) calendar-buffers) 2487 (if (memq (window-buffer w) calendar-buffers)
2481 (setq list (cons w list)))) 2488 (push w list)))
2482 nil t) 2489 nil t)
2483 list)) 2490 list))
2484 2491
@@ -2488,15 +2495,12 @@ the STRINGS are just concatenated and the result truncated."
2488 (buffers (list "*Yahrzeits*" lunar-phases-buffer holiday-buffer 2495 (buffers (list "*Yahrzeits*" lunar-phases-buffer holiday-buffer
2489 fancy-diary-buffer diary-buffer calendar-buffer 2496 fancy-diary-buffer diary-buffer calendar-buffer
2490 other-calendars-buffer)) 2497 other-calendars-buffer))
2491 (buffer-list nil) 2498 (buffer-list nil))
2492 b) 2499 (dolist (b buffers)
2493 (while buffers
2494 (setq b (car buffers))
2495 (setq b (cond ((stringp b) (get-buffer b)) 2500 (setq b (cond ((stringp b) (get-buffer b))
2496 ((bufferp b) b) 2501 ((bufferp b) b)
2497 (t nil))) 2502 (t nil)))
2498 (if b (setq buffer-list (cons b buffer-list))) 2503 (if b (push b buffer-list)))
2499 (setq buffers (cdr buffers)))
2500 buffer-list)) 2504 buffer-list))
2501 2505
2502(defun exit-calendar () 2506(defun exit-calendar ()
@@ -2642,7 +2646,7 @@ With argument, jump to mark, pop it, and put point at end of ring."
2642 (let ((date (calendar-cursor-to-date t))) 2646 (let ((date (calendar-cursor-to-date t)))
2643 (if (null arg) 2647 (if (null arg)
2644 (progn 2648 (progn
2645 (setq calendar-mark-ring (cons date calendar-mark-ring)) 2649 (push date calendar-mark-ring)
2646 ;; Since the top of the mark ring is the marked date in the 2650 ;; Since the top of the mark ring is the marked date in the
2647 ;; calendar, the mark ring in the calendar is one longer than 2651 ;; calendar, the mark ring in the calendar is one longer than
2648 ;; in other buffers to get the same effect. 2652 ;; in other buffers to get the same effect.
@@ -2949,16 +2953,18 @@ MARK defaults to `diary-entry-marker'."
2949 "Replace the date under the cursor in the calendar window with asterisks. 2953 "Replace the date under the cursor in the calendar window with asterisks.
2950This function can be used with the `today-visible-calendar-hook' run after the 2954This function can be used with the `today-visible-calendar-hook' run after the
2951calendar window has been prepared." 2955calendar window has been prepared."
2952 (let ((inhibit-read-only t)) 2956 (let ((inhibit-read-only t)
2953 (make-local-variable 'calendar-starred-day) 2957 (modified (buffer-modified-p)))
2954 (forward-char 1) 2958 (forward-char 1)
2955 (setq calendar-starred-day 2959 (set (make-local-variable 'calendar-starred-day)
2956 (string-to-number 2960 (string-to-number
2957 (buffer-substring (point) (- (point) 2)))) 2961 (buffer-substring (point) (- (point) 2))))
2958 (delete-char -2) 2962 ;; Insert before deleting, to better preserve markers.
2959 (insert "**") 2963 (insert "**")
2960 (backward-char 1) 2964 (forward-char -2)
2961 (set-buffer-modified-p nil))) 2965 (delete-char -2)
2966 (forward-char 1)
2967 (restore-buffer-modified-p modified)))
2962 2968
2963(defun calendar-mark-today () 2969(defun calendar-mark-today ()
2964 "Mark the date under the cursor in the calendar window. 2970 "Mark the date under the cursor in the calendar window.
@@ -3048,48 +3054,48 @@ Defaults to today's date if DATE is not given."
3048 (interactive) 3054 (interactive)
3049 (let* ((date (calendar-cursor-to-date t))) 3055 (let* ((date (calendar-cursor-to-date t)))
3050 (with-current-buffer (get-buffer-create other-calendars-buffer) 3056 (with-current-buffer (get-buffer-create other-calendars-buffer)
3051 (setq buffer-read-only nil) 3057 (let ((inhibit-read-only t)
3052 (calendar-set-mode-line 3058 (modified (buffer-modified-p)))
3053 (concat (calendar-date-string date) " (Gregorian)")) 3059 (calendar-set-mode-line
3054 (erase-buffer) 3060 (concat (calendar-date-string date) " (Gregorian)"))
3055 (insert 3061 (erase-buffer)
3056 (mapconcat 'identity 3062 (apply
3057 (list (calendar-day-of-year-string date) 3063 'insert
3058 (format "ISO date: %s" (calendar-iso-date-string date)) 3064 (delq nil
3059 (format "Julian date: %s" 3065 (list
3060 (calendar-julian-date-string date)) 3066 (calendar-day-of-year-string date) "\n"
3061 (format 3067 (format "ISO date: %s\n" (calendar-iso-date-string date))
3062 "Astronomical (Julian) day number (at noon UTC): %s.0" 3068 (format "Julian date: %s\n"
3063 (calendar-astro-date-string date)) 3069 (calendar-julian-date-string date))
3064 (format "Fixed (RD) date: %s" 3070 (format "Astronomical (Julian) day number (at noon UTC): %s.0\n"
3065 (calendar-absolute-from-gregorian date)) 3071 (calendar-astro-date-string date))
3066 (format "Hebrew date (before sunset): %s" 3072 (format "Fixed (RD) date: %s\n"
3067 (calendar-hebrew-date-string date)) 3073 (calendar-absolute-from-gregorian date))
3068 (format "Persian date: %s" 3074 (format "Hebrew date (before sunset): %s\n"
3069 (calendar-persian-date-string date)) 3075 (calendar-hebrew-date-string date))
3070 (let ((i (calendar-islamic-date-string date))) 3076 (format "Persian date: %s\n"
3071 (if (not (string-equal i "")) 3077 (calendar-persian-date-string date))
3072 (format "Islamic date (before sunset): %s" i))) 3078 (let ((i (calendar-islamic-date-string date)))
3073 (let ((b (calendar-bahai-date-string date))) 3079 (if (not (string-equal i ""))
3074 (if (not (string-equal b "")) 3080 (format "Islamic date (before sunset): %s\n" i)))
3075 (format "Baha'i date (before sunset): %s" b))) 3081 (let ((b (calendar-bahai-date-string date)))
3076 (format "Chinese date: %s" 3082 (if (not (string-equal b ""))
3077 (calendar-chinese-date-string date)) 3083 (format "Baha'i date (before sunset): %s\n" b)))
3078 (let ((c (calendar-coptic-date-string date))) 3084 (format "Chinese date: %s\n"
3079 (if (not (string-equal c "")) 3085 (calendar-chinese-date-string date))
3080 (format "Coptic date: %s" c))) 3086 (let ((c (calendar-coptic-date-string date)))
3081 (let ((e (calendar-ethiopic-date-string date))) 3087 (if (not (string-equal c ""))
3082 (if (not (string-equal e "")) 3088 (format "Coptic date: %s\n" c)))
3083 (format "Ethiopic date: %s" e))) 3089 (let ((e (calendar-ethiopic-date-string date)))
3084 (let ((f (calendar-french-date-string date))) 3090 (if (not (string-equal e ""))
3085 (if (not (string-equal f "")) 3091 (format "Ethiopic date: %s\n" e)))
3086 (format "French Revolutionary date: %s" f))) 3092 (let ((f (calendar-french-date-string date)))
3087 (format "Mayan date: %s" 3093 (if (not (string-equal f ""))
3088 (calendar-mayan-date-string date))) 3094 (format "French Revolutionary date: %s\n" f)))
3089 "\n")) 3095 (format "Mayan date: %s\n"
3090 (goto-char (point-min)) 3096 (calendar-mayan-date-string date)))))
3091 (set-buffer-modified-p nil) 3097 (goto-char (point-min))
3092 (setq buffer-read-only t) 3098 (restore-buffer-modified-p modified))
3093 (display-buffer other-calendars-buffer)))) 3099 (display-buffer other-calendars-buffer))))
3094 3100
3095(defun calendar-print-day-of-year () 3101(defun calendar-print-day-of-year ()
@@ -3099,11 +3105,15 @@ Defaults to today's date if DATE is not given."
3099 3105
3100(defun calendar-set-mode-line (str) 3106(defun calendar-set-mode-line (str)
3101 "Set mode line to STR, centered, surrounded by dashes." 3107 "Set mode line to STR, centered, surrounded by dashes."
3102 (setq mode-line-format 3108 (let* ((edges (window-edges))
3103 (calendar-string-spread
3104 (list str) ?-
3105 ;; As per doc of window-width, total visible mode-line length. 3109 ;; As per doc of window-width, total visible mode-line length.
3106 (let ((edges (window-edges))) (- (nth 2 edges) (nth 0 edges)))))) 3110 (width (- (nth 2 edges) (nth 0 edges))))
3111 (setq mode-line-format
3112 (if buffer-file-name
3113 `("-" mode-line-modified
3114 ,(calendar-string-spread (list str) ?- (- width 6))
3115 "---")
3116 (calendar-string-spread (list str) ?- width)))))
3107 3117
3108(defun calendar-mod (m n) 3118(defun calendar-mod (m n)
3109 "Non-negative remainder of M/N with N instead of 0." 3119 "Non-negative remainder of M/N with N instead of 0."