1 ;;; diary-lib.el --- diary functions.
3 ;; Copyright (C) 1989, 1990, 1992, 1993, 1994, 1995 Free Software Foundation,
6 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to
23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
27 ;; This collection of functions implements the diary features as described
30 ;; Comments, corrections, and improvements should be sent to
31 ;; Edward M. Reingold Department of Computer Science
32 ;; (217) 333-6733 University of Illinois at Urbana-Champaign
33 ;; reingold@cs.uiuc.edu 1304 West Springfield Avenue
34 ;; Urbana, Illinois 61801
41 (defun diary (&optional arg)
42 "Generate the diary window for ARG days starting with the current date.
43 If no argument is provided, the number of days of diary entries is governed
44 by the variable `number-of-diary-entries'. This function is suitable for
45 execution in a `.emacs' file."
47 (let ((d-file (substitute-in-file-name diary-file))
48 (date (calendar-current-date)))
49 (if (and d-file (file-exists-p d-file))
50 (if (file-readable-p d-file)
54 (arg (prefix-numeric-value arg))
55 ((vectorp number-of-diary-entries)
56 (aref number-of-diary-entries (calendar-day-of-week date)))
57 (t number-of-diary-entries)))
58 (error "Your diary file is not readable!"))
59 (error "You don't have a diary file!"))))
61 (defun view-diary-entries (arg)
62 "Prepare and display a buffer with diary entries.
63 Searches the file named in `diary-file' for entries that
64 match ARG days starting with the date indicated by the cursor position
65 in the displayed three-month calendar."
67 (let ((d-file (substitute-in-file-name diary-file)))
68 (if (and d-file (file-exists-p d-file))
69 (if (file-readable-p d-file)
70 (list-diary-entries (calendar-cursor-to-date t) arg)
71 (error "Diary file is not readable!"))
72 (error "You don't have a diary file!"))))
74 (defun view-other-diary-entries (arg diary-file)
75 "Prepare and display buffer of diary entries from an alternative diary file.
76 Prompts for a file name and searches that file for entries that match ARG
77 days starting with the date indicated by the cursor position in the displayed
78 three-month calendar."
80 (list (cond ((null current-prefix-arg) 1)
81 ((listp current-prefix-arg) (car current-prefix-arg))
82 (t current-prefix-arg))
83 (setq diary-file (read-file-name "Enter diary file name: "
84 default-directory nil t))))
85 (view-diary-entries arg))
87 (autoload 'check-calendar-holidays "holidays"
88 "Check the list of holidays for any that occur on DATE.
89 The value returned is a list of strings of relevant holiday descriptions.
90 The holidays are those in the list `calendar-holidays'."
93 (autoload 'calendar-holiday-list "holidays"
94 "Form the list of holidays that occur on dates in the calendar window.
95 The holidays are those in the list `calendar-holidays'."
98 (autoload 'diary-french-date "cal-french"
99 "French calendar equivalent of date diary entry."
102 (autoload 'diary-mayan-date "cal-mayan"
103 "Mayan calendar equivalent of date diary entry."
106 (autoload 'diary-julian-date "cal-julian"
107 "Julian calendar equivalent of date diary entry."
110 (autoload 'diary-astro-day-number "cal-julian"
111 "Astronomical (Julian) day number diary entry."
114 (autoload 'diary-chinese-date "cal-chinese"
115 "Chinese calendar equivalent of date diary entry."
118 (autoload 'diary-islamic-date "cal-islamic"
119 "Islamic calendar equivalent of date diary entry."
122 (autoload 'list-islamic-diary-entries "cal-islamic"
123 "Add any Islamic date entries from the diary file to `diary-entries-list'."
126 (autoload 'mark-islamic-diary-entries "cal-islamic"
127 "Mark days in the calendar window that have Islamic date diary entries."
130 (autoload 'mark-islamic-calendar-date-pattern "cal-islamic"
131 "Mark dates in calendar window that conform to Islamic date MONTH/DAY/YEAR."
134 (autoload 'diary-hebrew-date "cal-hebrew"
135 "Hebrew calendar equivalent of date diary entry."
138 (autoload 'diary-omer "cal-hebrew"
139 "Omer count diary entry."
142 (autoload 'diary-yahrzeit "cal-hebrew"
143 "Yahrzeit diary entry--entry applies if date is yahrzeit or the day before."
146 (autoload 'diary-parasha "cal-hebrew"
147 "Parasha diary entry--entry applies if date is a Saturday."
150 (autoload 'diary-rosh-hodesh "cal-hebrew"
151 "Rosh Hodesh diary entry."
154 (autoload 'list-hebrew-diary-entries "cal-hebrew"
155 "Add any Hebrew date entries from the diary file to `diary-entries-list'."
158 (autoload 'mark-hebrew-diary-entries "cal-hebrew"
159 "Mark days in the calendar window that have Hebrew date diary entries."
162 (autoload 'mark-hebrew-calendar-date-pattern "cal-hebrew"
163 "Mark dates in calendar window that conform to Hebrew date MONTH/DAY/YEAR."
166 (autoload 'diary-coptic-date "cal-coptic"
167 "Coptic calendar equivalent of date diary entry."
170 (autoload 'diary-ethiopic-date "cal-coptic"
171 "Ethiopic calendar equivalent of date diary entry."
174 (autoload 'diary-phases-of-moon "lunar" "Moon phases diary entry." t)
176 (autoload 'diary-sunrise-sunset "solar"
177 "Local time of sunrise and sunset as a diary entry."
180 (autoload 'diary-sabbath-candles "solar"
181 "Local time of candle lighting diary entry--applies if date is a Friday.
182 No diary entry if there is no sunset on that date."
185 (defvar diary-syntax-table (copy-syntax-table (standard-syntax-table))
186 "The syntax table used when parsing dates in the diary file.
187 It is the standard syntax table used in Fundamental mode, but with the
188 syntax of `*' changed to be a word constituent.")
190 (modify-syntax-entry ?* "w" diary-syntax-table)
192 (defun list-diary-entries (date number)
193 "Create and display a buffer containing the relevant lines in diary-file.
194 The arguments are DATE and NUMBER; the entries selected are those
195 for NUMBER days starting with date DATE. The other entries are hidden
196 using selective display.
198 Returns a list of all relevant diary entries found, if any, in order by date.
199 The list entries have the form ((month day year) string). If the variable
200 `diary-list-include-blanks' is t, this list includes a dummy diary entry
201 \(consisting of the empty string) for a date with no diary entries.
203 After the list is prepared, the hooks `nongregorian-diary-listing-hook',
204 `list-diary-entries-hook', `diary-display-hook', and `diary-hook' are run.
205 These hooks have the following distinct roles:
207 `nongregorian-diary-listing-hook' can cull dates from the diary
208 and each included file. Usually used for Hebrew or Islamic
209 diary entries in files. Applied to *each* file.
211 `list-diary-entries-hook' adds or manipulates diary entries from
212 external sources. Used, for example, to include diary entries
213 from other files or to sort the diary entries. Invoked *once* only,
214 before the display hook is run.
216 `diary-display-hook' does the actual display of information. If this is
217 nil, simple-diary-display will be used. Use add-hook to set this to
218 fancy-diary-display, if desired. If you want no diary display, use
219 add-hook to set this to ignore.
221 `diary-hook' is run last. This can be used for an appointment
222 notification function."
225 (let* ((original-date date);; save for possible use in the hooks
226 (old-diary-syntax-table)
228 (date-string (calendar-date-string date))
229 (d-file (substitute-in-file-name diary-file)))
230 (message "Preparing diary...")
232 (let ((diary-buffer (get-file-buffer d-file)))
233 (set-buffer (if diary-buffer
235 (find-file-noselect d-file t))))
236 (setq selective-display t)
237 (setq selective-display-ellipses nil)
238 (setq old-diary-syntax-table (syntax-table))
239 (set-syntax-table diary-syntax-table)
241 (let ((buffer-read-only nil)
242 (diary-modified (buffer-modified-p))
243 (mark (regexp-quote diary-nonmarking-symbol)))
244 (goto-char (1- (point-max)))
245 (if (not (looking-at "\^M\\|\n"))
248 (insert-string "\^M")))
249 (goto-char (point-min))
250 (if (not (looking-at "\^M\\|\n"))
251 (insert-string "\^M"))
252 (subst-char-in-region (point-min) (point-max) ?\n ?\^M t)
253 (calendar-for-loop i from 1 to number do
254 (let ((d diary-date-forms)
255 (month (extract-calendar-month date))
256 (day (extract-calendar-day date))
257 (year (extract-calendar-year date))
258 (entry-found (list-sexp-diary-entries date)))
261 ((date-form (if (equal (car (car d)) 'backup)
264 (backup (equal (car (car d)) 'backup))
267 (calendar-day-name date) "\\|"
268 (substring (calendar-day-name date) 0 3) ".?"))
272 (calendar-month-name month) "\\|"
273 (substring (calendar-month-name month) 0 3) ".?"))
274 (month (concat "\\*\\|0*" (int-to-string month)))
275 (day (concat "\\*\\|0*" (int-to-string day)))
278 "\\*\\|0*" (int-to-string year)
279 (if abbreviated-calendar-year
280 (concat "\\|" (int-to-string (% year 100)))
284 "\\(\\`\\|\^M\\|\n\\)" mark "?\\("
285 (mapconcat 'eval date-form "\\)\\(")
287 (case-fold-search t))
288 (goto-char (point-min))
289 (while (re-search-forward regexp nil t)
290 (if backup (re-search-backward "\\<" nil t))
291 (if (and (or (char-equal (preceding-char) ?\^M)
292 (char-equal (preceding-char) ?\n))
293 (not (looking-at " \\|\^I")))
294 ;; Diary entry that consists only of date.
296 ;; Found a nonempty diary entry--make it visible and
297 ;; add it to the list.
299 (let ((entry-start (point))
301 (re-search-backward "\^M\\|\n\\|\\`")
302 (setq date-start (point))
303 (re-search-forward "\^M\\|\n" nil t 2)
304 (while (looking-at " \\|\^I")
305 (re-search-forward "\^M\\|\n" nil t))
307 (subst-char-in-region date-start
311 (buffer-substring-no-properties
312 entry-start (point)))))))
315 (not diary-list-include-blanks)
316 (setq diary-entries-list
317 (append diary-entries-list
318 (list (list date "")))))
320 (calendar-gregorian-from-absolute
321 (1+ (calendar-absolute-from-gregorian date))))
322 (setq entry-found nil)))
323 (set-buffer-modified-p diary-modified))
324 (set-syntax-table old-diary-syntax-table))
325 (goto-char (point-min))
326 (run-hooks 'nongregorian-diary-listing-hook
327 'list-diary-entries-hook)
328 (if diary-display-hook
329 (run-hooks 'diary-display-hook)
330 (simple-diary-display))
331 (run-hooks 'diary-hook)
332 diary-entries-list))))
334 (defun include-other-diary-files ()
335 "Include the diary entries from other diary files with those of diary-file.
336 This function is suitable for use in `list-diary-entries-hook';
337 it enables you to use shared diary files together with your own.
338 The files included are specified in the diaryfile by lines of this form:
339 #include \"filename\"
340 This is recursive; that is, #include directives in diary files thus included
341 are obeyed. You can change the `#include' to some other string by
342 changing the variable `diary-include-string'."
343 (goto-char (point-min))
344 (while (re-search-forward
346 "\\(\\`\\|\^M\\|\n\\)"
347 (regexp-quote diary-include-string)
350 (let ((diary-file (substitute-in-file-name
351 (buffer-substring-no-properties
352 (match-beginning 2) (match-end 2))))
353 (diary-list-include-blanks nil)
354 (list-diary-entries-hook 'include-other-diary-files)
355 (diary-display-hook 'ignore)
357 (if (file-exists-p diary-file)
358 (if (file-readable-p diary-file)
360 (setq diary-entries-list
361 (append diary-entries-list
362 (list-diary-entries original-date number)))
363 (kill-buffer (get-file-buffer diary-file)))
365 (message "Can't read included diary file %s" diary-file)
368 (message "Can't find included diary file %s" diary-file)
370 (goto-char (point-min)))
372 (defun simple-diary-display ()
373 "Display the diary buffer if there are any relevant entries or holidays."
374 (let* ((holiday-list (if holidays-in-diary-buffer
375 (check-calendar-holidays original-date)))
376 (msg (format "No diary entries for %s %s"
377 (concat date-string (if holiday-list ":" ""))
378 (mapconcat 'identity holiday-list "; "))))
379 (if (or (not diary-entries-list)
380 (and (not (cdr diary-entries-list))
381 (string-equal (car (cdr (car diary-entries-list))) "")))
382 (if (<= (length msg) (frame-width))
384 (set-buffer (get-buffer-create holiday-buffer))
385 (setq buffer-read-only nil)
386 (calendar-set-mode-line date-string)
388 (insert (mapconcat 'identity holiday-list "\n"))
389 (goto-char (point-min))
390 (set-buffer-modified-p nil)
391 (setq buffer-read-only t)
392 (display-buffer holiday-buffer)
393 (message "No diary entries for %s" date-string))
394 (calendar-set-mode-line
395 (concat "Diary for " date-string
396 (if holiday-list ": " "")
397 (mapconcat 'identity holiday-list "; ")))
398 (display-buffer (get-file-buffer d-file))
399 (message "Preparing diary...done"))))
401 (defun fancy-diary-display ()
402 "Prepare a diary buffer with relevant entries in a fancy, noneditable form.
403 This function is provided for optional use as the `diary-display-hook'."
404 (save-excursion;; Turn off selective-display in the diary file's buffer.
405 (set-buffer (get-file-buffer (substitute-in-file-name diary-file)))
406 (let ((diary-modified (buffer-modified-p)))
407 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)
408 (setq selective-display nil)
409 (kill-local-variable 'mode-line-format)
410 (set-buffer-modified-p diary-modified)))
411 (if (or (not diary-entries-list)
412 (and (not (cdr diary-entries-list))
413 (string-equal (car (cdr (car diary-entries-list))) "")))
414 (let* ((holiday-list (if holidays-in-diary-buffer
415 (check-calendar-holidays original-date)))
416 (msg (format "No diary entries for %s %s"
417 (concat date-string (if holiday-list ":" ""))
418 (mapconcat 'identity holiday-list "; "))))
419 (if (<= (length msg) (frame-width))
421 (set-buffer (get-buffer-create holiday-buffer))
422 (setq buffer-read-only nil)
423 (calendar-set-mode-line date-string)
425 (insert (mapconcat 'identity holiday-list "\n"))
426 (goto-char (point-min))
427 (set-buffer-modified-p nil)
428 (setq buffer-read-only t)
429 (display-buffer holiday-buffer)
430 (message "No diary entries for %s" date-string)))
431 (save-excursion;; Prepare the fancy diary buffer.
432 (set-buffer (make-fancy-diary-buffer))
433 (setq buffer-read-only nil)
434 (let ((entry-list diary-entries-list)
436 (holiday-list-last-month 1)
437 (holiday-list-last-year 1)
440 (if (not (calendar-date-equal date (car (car entry-list))))
442 (setq date (car (car entry-list)))
443 (and holidays-in-diary-buffer
444 (calendar-date-compare
445 (list (list holiday-list-last-month
446 (calendar-last-day-of-month
447 holiday-list-last-month
448 holiday-list-last-year)
449 holiday-list-last-year))
451 ;; We need to get the holidays for the next 3 months.
452 (setq holiday-list-last-month
453 (extract-calendar-month date))
454 (setq holiday-list-last-year
455 (extract-calendar-year date))
456 (increment-calendar-month
457 holiday-list-last-month holiday-list-last-year 1)
459 (let ((displayed-month holiday-list-last-month)
460 (displayed-year holiday-list-last-year))
461 (calendar-holiday-list)))
462 (increment-calendar-month
463 holiday-list-last-month holiday-list-last-year 1))
464 (let* ((date-string (calendar-date-string date))
466 (let ((h holiday-list)
468 ;; Make a list of all holidays for date.
470 (if (calendar-date-equal date (car (car h)))
471 (setq d (append d (cdr (car h)))))
474 (insert (if (= (point) (point-min)) "" ?\n) date-string)
475 (if date-holiday-list (insert ": "))
476 (let ((l (current-column)))
477 (insert (mapconcat 'identity date-holiday-list
478 (concat "\n" (make-string l ? )))))
479 (let ((l (current-column)))
480 (insert ?\n (make-string l ?=) ?\n)))))
481 (if (< 0 (length (car (cdr (car entry-list)))))
482 (insert (car (cdr (car entry-list))) ?\n))
483 (setq entry-list (cdr entry-list))))
484 (set-buffer-modified-p nil)
485 (goto-char (point-min))
486 (setq buffer-read-only t)
487 (display-buffer fancy-diary-buffer)
488 (message "Preparing diary...done"))))
490 (defun make-fancy-diary-buffer ()
491 "Create and return the initial fancy diary buffer."
493 (set-buffer (get-buffer-create fancy-diary-buffer))
494 (setq buffer-read-only nil)
495 (make-local-variable 'mode-line-format)
496 (calendar-set-mode-line "Diary Entries")
498 (set-buffer-modified-p nil)
499 (setq buffer-read-only t)
500 (get-buffer fancy-diary-buffer)))
502 (defun print-diary-entries ()
503 "Print a hard copy of the diary display.
505 If the simple diary display is being used, prepare a temp buffer with the
506 visible lines of the diary buffer, add a heading line composed from the mode
507 line, print the temp buffer, and destroy it.
509 If the fancy diary display is being used, just print the buffer.
511 The hooks given by the variable `print-diary-entries-hook' are called to do
512 the actual printing."
514 (if (bufferp (get-buffer fancy-diary-buffer))
516 (set-buffer (get-buffer fancy-diary-buffer))
517 (run-hooks 'print-diary-entries-hook))
519 (get-file-buffer (substitute-in-file-name diary-file))))
521 (let ((temp-buffer (get-buffer-create "*Printable Diary Entries*"))
524 (set-buffer diary-buffer)
526 (if (not (stringp mode-line-format))
528 (string-match "^-*\\([^-].*[^-]\\)-*$" mode-line-format)
529 (substring mode-line-format
530 (match-beginning 1) (match-end 1))))
531 (copy-to-buffer temp-buffer (point-min) (point-max))
532 (set-buffer temp-buffer)
533 (while (re-search-forward "\^M.*$" nil t)
535 (goto-char (point-min))
537 (make-string (length heading) ?=) "\n")
538 (run-hooks 'print-diary-entries-hook)
539 (kill-buffer temp-buffer)))
540 (error "You don't have a diary buffer!")))))
542 (defun show-all-diary-entries ()
543 "Show all of the diary entries in the diary file.
544 This function gets rid of the selective display of the diary file so that
545 all entries, not just some, are visible. If there is no diary buffer, one
548 (let ((d-file (substitute-in-file-name diary-file)))
549 (if (and d-file (file-exists-p d-file))
550 (if (file-readable-p d-file)
552 (let ((diary-buffer (get-file-buffer d-file)))
553 (set-buffer (if diary-buffer
555 (find-file-noselect d-file t)))
556 (let ((buffer-read-only nil)
557 (diary-modified (buffer-modified-p)))
558 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)
559 (setq selective-display nil)
560 (make-local-variable 'mode-line-format)
561 (setq mode-line-format default-mode-line-format)
562 (display-buffer (current-buffer))
563 (set-buffer-modified-p diary-modified))))
564 (error "Your diary file is not readable!"))
565 (error "You don't have a diary file!"))))
567 (defun diary-name-pattern (string-array &optional fullname)
568 "Convert an STRING-ARRAY, an array of strings to a pattern.
569 The pattern will match any of the strings, either entirely or abbreviated
570 to three characters. An abbreviated form will match with or without a period;
571 If the optional FULLNAME is t, abbreviations will not match, just the full
574 (calendar-for-loop i from 0 to (1- (length string-array)) do
578 (if (string-equal pattern "") "" "\\|")
579 (aref string-array i)
584 (substring (aref string-array i) 0 3) ".?")))))
587 (defvar marking-diary-entries nil
588 "True during the marking of diary entries, nil otherwise.")
590 (defvar marking-diary-entry nil
591 "True during the marking of diary entries, if current entry is marking.")
593 (defun mark-diary-entries ()
594 "Mark days in the calendar window that have diary entries.
595 Each entry in the diary file visible in the calendar window is marked.
596 After the entries are marked, the hooks `nongregorian-diary-marking-hook' and
597 `mark-diary-entries-hook' are run."
599 (setq mark-diary-entries-in-calendar t)
600 (let ((d-file (substitute-in-file-name diary-file))
601 (marking-diary-entries t))
602 (if (and d-file (file-exists-p d-file))
603 (if (file-readable-p d-file)
605 (message "Marking diary entries...")
606 (set-buffer (find-file-noselect d-file t))
607 (let ((d diary-date-forms)
608 (old-diary-syntax-table))
609 (setq old-diary-syntax-table (syntax-table))
610 (set-syntax-table diary-syntax-table)
613 ((date-form (if (equal (car (car d)) 'backup)
615 (car d)));; ignore 'backup directive
616 (dayname (diary-name-pattern calendar-day-name-array))
619 (diary-name-pattern calendar-month-name-array)
621 (month "[0-9]+\\|\\*")
623 (year "[0-9]+\\|\\*")
624 (l (length date-form))
625 (d-name-pos (- l (length (memq 'dayname date-form))))
626 (d-name-pos (if (/= l d-name-pos) (+ 2 d-name-pos)))
627 (m-name-pos (- l (length (memq 'monthname date-form))))
628 (m-name-pos (if (/= l m-name-pos) (+ 2 m-name-pos)))
629 (d-pos (- l (length (memq 'day date-form))))
630 (d-pos (if (/= l d-pos) (+ 2 d-pos)))
631 (m-pos (- l (length (memq 'month date-form))))
632 (m-pos (if (/= l m-pos) (+ 2 m-pos)))
633 (y-pos (- l (length (memq 'year date-form))))
634 (y-pos (if (/= l y-pos) (+ 2 y-pos)))
637 "\\(\\`\\|\^M\\|\n\\)\\("
638 (mapconcat 'eval date-form "\\)\\(")
640 (case-fold-search t))
641 (goto-char (point-min))
642 (while (re-search-forward regexp nil t)
645 (buffer-substring-no-properties
646 (match-beginning d-name-pos)
647 (match-end d-name-pos))))
650 (buffer-substring-no-properties
651 (match-beginning m-name-pos)
652 (match-end m-name-pos))))
655 (buffer-substring-no-properties
656 (match-beginning m-pos)
661 (buffer-substring-no-properties
662 (match-beginning d-pos)
666 (buffer-substring-no-properties
667 (match-beginning y-pos)
671 (if (and (= (length y-str) 2)
672 abbreviated-calendar-year)
674 (extract-calendar-year
675 (calendar-current-date)))
676 (y (+ (string-to-int y-str)
678 (/ current-y 100)))))
679 (if (> (- y current-y) 50)
681 (if (> (- current-y y) 50)
684 (string-to-int y-str)))))
686 (mark-calendar-days-named
687 (cdr (assoc (capitalize (substring dd-name 0 3))
689 calendar-day-name-array
691 '(lambda (x) (substring x 0 3))))))
693 (if (string-equal mm-name "*")
698 (substring mm-name 0 3))
700 calendar-month-name-array
702 '(lambda (x) (substring x 0 3)))
704 (mark-calendar-date-pattern mm dd yy))))
706 (mark-sexp-diary-entries)
707 (run-hooks 'nongregorian-diary-marking-hook
708 'mark-diary-entries-hook)
709 (set-syntax-table old-diary-syntax-table)
710 (message "Marking diary entries...done")))
711 (error "Your diary file is not readable!"))
712 (error "You don't have a diary file!"))))
714 (defun mark-sexp-diary-entries ()
715 "Mark days in the calendar window that have sexp diary entries.
716 Each entry in the diary file (or included files) visible in the calendar window
717 is marked. See the documentation for the function `list-sexp-diary-entries'."
718 (let* ((sexp-mark (regexp-quote sexp-diary-entry-symbol))
719 (s-entry (concat "\\(\\`\\|\^M\\|\n\\)\\("
720 (regexp-quote sexp-mark) "(\\)\\|\\("
721 (regexp-quote diary-nonmarking-symbol)
722 (regexp-quote sexp-mark) "(diary-remind\\)"))
728 (set-buffer calendar-buffer)
729 (setq m displayed-month)
730 (setq y displayed-year))
731 (increment-calendar-month m y -1)
733 (calendar-absolute-from-gregorian (list m 1 y)))
734 (increment-calendar-month m y 2)
736 (calendar-absolute-from-gregorian
737 (list m (calendar-last-day-of-month m y) y)))
738 (goto-char (point-min))
739 (while (re-search-forward s-entry nil t)
740 (if (char-equal (preceding-char) ?\()
741 (setq marking-diary-entry t)
742 (setq marking-diary-entry nil))
743 (re-search-backward "(")
744 (let ((sexp-start (point))
750 (setq sexp (buffer-substring-no-properties sexp-start (point)))
752 (re-search-backward "\^M\\|\n\\|\\`")
753 (setq line-start (point)))
755 (if (and (or (char-equal (preceding-char) ?\^M)
756 (char-equal (preceding-char) ?\n))
757 (not (looking-at " \\|\^I")))
758 (progn;; Diary entry consists only of the sexp
761 (setq entry-start (point))
762 (re-search-forward "\^M\\|\n" nil t)
763 (while (looking-at " \\|\^I")
764 (re-search-forward "\^M\\|\n" nil t))
766 (setq entry (buffer-substring-no-properties entry-start (point)))
767 (while (string-match "[\^M]" entry)
768 (aset entry (match-beginning 0) ?\n )))
769 (calendar-for-loop date from first-date to last-date do
770 (if (diary-sexp-entry sexp entry
771 (calendar-gregorian-from-absolute date))
772 (mark-visible-calendar-date
773 (calendar-gregorian-from-absolute date))))))))
775 (defun mark-included-diary-files ()
776 "Mark the diary entries from other diary files with those of the diary file.
777 This function is suitable for use as the `mark-diary-entries-hook'; it enables
778 you to use shared diary files together with your own. The files included are
779 specified in the diary-file by lines of this form:
780 #include \"filename\"
781 This is recursive; that is, #include directives in diary files thus included
782 are obeyed. You can change the `#include' to some other string by
783 changing the variable `diary-include-string'."
784 (goto-char (point-min))
785 (while (re-search-forward
787 "\\(\\`\\|\^M\\|\n\\)"
788 (regexp-quote diary-include-string)
791 (let ((diary-file (substitute-in-file-name
792 (buffer-substring-no-properties
793 (match-beginning 2) (match-end 2))))
794 (mark-diary-entries-hook 'mark-included-diary-files))
795 (if (file-exists-p diary-file)
796 (if (file-readable-p diary-file)
799 (kill-buffer (get-file-buffer diary-file)))
801 (message "Can't read included diary file %s" diary-file)
804 (message "Can't find included diary file %s" diary-file)
806 (goto-char (point-min)))
808 (defun mark-calendar-days-named (dayname)
809 "Mark all dates in the calendar window that are day DAYNAME of the week.
810 0 means all Sundays, 1 means all Mondays, and so on."
812 (set-buffer calendar-buffer)
813 (let ((prev-month displayed-month)
814 (prev-year displayed-year)
815 (succ-month displayed-month)
816 (succ-year displayed-year)
819 (increment-calendar-month succ-month succ-year 1)
820 (increment-calendar-month prev-month prev-year -1)
821 (setq day (calendar-absolute-from-gregorian
822 (calendar-nth-named-day 1 dayname prev-month prev-year)))
823 (setq last-day (calendar-absolute-from-gregorian
824 (calendar-nth-named-day -1 dayname succ-month succ-year)))
825 (while (<= day last-day)
826 (mark-visible-calendar-date (calendar-gregorian-from-absolute day))
827 (setq day (+ day 7))))))
829 (defun mark-calendar-date-pattern (month day year)
830 "Mark all dates in the calendar window that conform to MONTH/DAY/YEAR.
831 A value of 0 in any position is a wildcard."
833 (set-buffer calendar-buffer)
834 (let ((m displayed-month)
836 (increment-calendar-month m y -1)
837 (calendar-for-loop i from 0 to 2 do
838 (mark-calendar-month m y month day year)
839 (increment-calendar-month m y 1)))))
841 (defun mark-calendar-month (month year p-month p-day p-year)
842 "Mark dates in the MONTH/YEAR that conform to pattern P-MONTH/P_DAY/P-YEAR.
843 A value of 0 in any position of the pattern is a wildcard."
844 (if (or (and (= month p-month)
845 (or (= p-year 0) (= year p-year)))
847 (or (= p-year 0) (= year p-year))))
850 i from 1 to (calendar-last-day-of-month month year) do
851 (mark-visible-calendar-date (list month i year)))
852 (mark-visible-calendar-date (list month p-day year)))))
854 (defun sort-diary-entries ()
855 "Sort the list of diary entries by time of day."
856 (setq diary-entries-list (sort diary-entries-list 'diary-entry-compare)))
858 (defun diary-entry-compare (e1 e2)
859 "Returns t if E1 is earlier than E2."
860 (or (calendar-date-compare e1 e2)
861 (and (calendar-date-equal (car e1) (car e2))
862 (< (diary-entry-time (car (cdr e1)))
863 (diary-entry-time (car (cdr e2)))))))
865 (defun diary-entry-time (s)
866 "Time at the beginning of the string S in a military-style integer.
867 For example, returns 1325 for 1:25pm. Returns -9999 if no time is recognized.
868 The recognized forms are XXXX or X:XX or XX:XX (military time), XXam or XXpm,
869 and XX:XXam or XX:XXpm."
870 (cond ((string-match;; Military time
871 "^[ \t]*\\([0-9]?[0-9]\\):?\\([0-9][0-9]\\)\\(\\>\\|[^ap]\\)" s)
872 (+ (* 100 (string-to-int
873 (substring s (match-beginning 1) (match-end 1))))
874 (string-to-int (substring s (match-beginning 2) (match-end 2)))))
875 ((string-match;; Hour only XXam or XXpm
876 "^[ \t]*\\([0-9]?[0-9]\\)\\([ap]\\)m\\>" s)
877 (+ (* 100 (% (string-to-int
878 (substring s (match-beginning 1) (match-end 1)))
880 (if (string-equal "a"
881 (substring s (match-beginning 2) (match-end 2)))
883 ((string-match;; Hour and minute XX:XXam or XX:XXpm
884 "^[ \t]*\\([0-9]?[0-9]\\):\\([0-9][0-9]\\)\\([ap]\\)m\\>" s)
885 (+ (* 100 (% (string-to-int
886 (substring s (match-beginning 1) (match-end 1)))
888 (string-to-int (substring s (match-beginning 2) (match-end 2)))
889 (if (string-equal "a"
890 (substring s (match-beginning 3) (match-end 3)))
892 (t -9999)));; Unrecognizable
894 (defun list-sexp-diary-entries (date)
895 "Add sexp entries for DATE from the diary file to `diary-entries-list'.
896 Also, Make them visible in the diary file. Returns t if any entries were
899 Sexp diary entries must be prefaced by a `sexp-diary-entry-symbol' (normally
900 `%%'). The form of a sexp diary entry is
904 Both ENTRY and DATE are globally available when the SEXP is evaluated. If the
905 SEXP yields the value nil, the diary entry does not apply. If it yields a
906 non-nil value, ENTRY will be taken to apply to DATE; if the non-nil value is a
907 string, that string will be the diary entry in the fancy diary display.
909 For example, the following diary entry will apply to the 21st of the month
910 if it is a weekday and the Friday before if the 21st is on a weekend:
912 &%%(let ((dayname (calendar-day-of-week date))
913 (day (extract-calendar-day date)))
915 (and (= day 21) (memq dayname '(1 2 3 4 5)))
916 (and (memq day '(19 20)) (= dayname 5)))
917 ) UIUC pay checks deposited
919 A number of built-in functions are available for this type of diary entry:
921 %%(diary-date MONTH DAY YEAR) text
922 Entry applies if date is MONTH, DAY, YEAR if
923 `european-calendar-style' is nil, and DAY, MONTH, YEAR if
924 `european-calendar-style' is t. DAY, MONTH, and YEAR
925 can be lists of integers, the constant t, or an integer.
926 The constant t means all values.
928 %%(diary-float MONTH DAYNAME N) text
929 Entry will appear on the Nth DAYNAME of MONTH.
930 (DAYNAME=0 means Sunday, 1 means Monday, and so on;
931 if N is negative it counts backward from the end of
932 the month. MONTH can be a list of months, a single
933 month, or t to specify all months.
935 %%(diary-block M1 D1 Y1 M2 D2 Y2) text
936 Entry will appear on dates between M1/D1/Y1 and M2/D2/Y2,
937 inclusive. (If `european-calendar-style' is t, the
938 order of the parameters should be changed to D1, M1, Y1,
941 %%(diary-anniversary MONTH DAY YEAR) text
942 Entry will appear on anniversary dates of MONTH DAY, YEAR.
943 (If `european-calendar-style' is t, the order of the
944 parameters should be changed to DAY, MONTH, YEAR.) Text
945 can contain %d or %d%s; %d will be replaced by the number
946 of years since the MONTH DAY, YEAR and %s will be replaced
947 by the ordinal ending of that number (that is, `st', `nd',
948 `rd' or `th', as appropriate. The anniversary of February
949 29 is considered to be March 1 in a non-leap year.
951 %%(diary-cyclic N MONTH DAY YEAR) text
952 Entry will appear every N days, starting MONTH DAY, YEAR.
953 (If `european-calendar-style' is t, the order of the
954 parameters should be changed to N, DAY, MONTH, YEAR.) Text
955 can contain %d or %d%s; %d will be replaced by the number
956 of repetitions since the MONTH DAY, YEAR and %s will
957 be replaced by the ordinal ending of that number (that is,
958 `st', `nd', `rd' or `th', as appropriate.
960 %%(diary-remind SEXP DAYS &optional MARKING) text
961 Entry is a reminder for diary sexp SEXP. DAYS is either a
962 single number or a list of numbers indicating the number(s)
963 of days before the event that the warning(s) should occur.
964 If the current date is (one of) DAYS before the event
965 indicated by EXPR, then a suitable message (as specified
966 by `diary-remind-message') appears. In addition to the
967 reminders beforehand, the diary entry also appears on
968 the date itself. If optional MARKING is non-nil then the
969 *reminders* are marked on the calendar. Marking of
970 reminders is independent of whether the entry *itself* is
971 a marking or nonmarking one.
973 %%(diary-day-of-year)
974 Diary entries giving the day of the year and the number of
975 days remaining in the year will be made every day. Note
976 that since there is no text, it makes sense only if the
977 fancy diary display is used.
980 Diary entries giving the corresponding ISO commercial date
981 will be made every day. Note that since there is no text,
982 it makes sense only if the fancy diary display is used.
984 %%(diary-french-date)
985 Diary entries giving the corresponding French Revolutionary
986 date will be made every day. Note that since there is no
987 text, it makes sense only if the fancy diary display is used.
989 %%(diary-islamic-date)
990 Diary entries giving the corresponding Islamic date will be
991 made every day. Note that since there is no text, it
992 makes sense only if the fancy diary display is used.
994 %%(diary-hebrew-date)
995 Diary entries giving the corresponding Hebrew date will be
996 made every day. Note that since there is no text, it
997 makes sense only if the fancy diary display is used.
999 %%(diary-astro-day-number) Diary entries giving the corresponding
1000 astronomical (Julian) day number will be made every day.
1001 Note that since there is no text, it makes sense only if the
1002 fancy diary display is used.
1004 %%(diary-julian-date) Diary entries giving the corresponding
1005 Julian date will be made every day. Note that since
1006 there is no text, it makes sense only if the fancy diary
1009 %%(diary-sunrise-sunset)
1010 Diary entries giving the local times of sunrise and sunset
1011 will be made every day. Note that since there is no text,
1012 it makes sense only if the fancy diary display is used.
1013 Floating point required.
1015 %%(diary-phases-of-moon)
1016 Diary entries giving the times of the phases of the moon
1017 will be when appropriate. Note that since there is no text,
1018 it makes sense only if the fancy diary display is used.
1019 Floating point required.
1021 %%(diary-yahrzeit MONTH DAY YEAR) text
1022 Text is assumed to be the name of the person; the date is
1023 the date of death on the *civil* calendar. The diary entry
1024 will appear on the proper Hebrew-date anniversary and on the
1025 day before. (If `european-calendar-style' is t, the order
1026 of the parameters should be changed to DAY, MONTH, YEAR.)
1028 %%(diary-rosh-hodesh)
1029 Diary entries will be made on the dates of Rosh Hodesh on
1030 the Hebrew calendar. Note that since there is no text, it
1031 makes sense only if the fancy diary display is used.
1034 Diary entries giving the weekly parasha will be made on
1035 every Saturday. Note that since there is no text, it
1036 makes sense only if the fancy diary display is used.
1039 Diary entries giving the omer count will be made every day
1040 from Passover to Shavuot. Note that since there is no text,
1041 it makes sense only if the fancy diary display is used.
1043 Marking these entries is *extremely* time consuming, so these entries are
1044 best if they are nonmarking."
1045 (let* ((mark (regexp-quote diary-nonmarking-symbol))
1046 (sexp-mark (regexp-quote sexp-diary-entry-symbol))
1047 (s-entry (concat "\\(\\`\\|\^M\\|\n\\)" mark "?" sexp-mark "("))
1049 (goto-char (point-min))
1050 (while (re-search-forward s-entry nil t)
1052 (let ((sexp-start (point))
1058 (setq sexp (buffer-substring-no-properties sexp-start (point)))
1060 (re-search-backward "\^M\\|\n\\|\\`")
1061 (setq line-start (point)))
1063 (if (and (or (char-equal (preceding-char) ?\^M)
1064 (char-equal (preceding-char) ?\n))
1065 (not (looking-at " \\|\^I")))
1066 (progn;; Diary entry consists only of the sexp
1069 (setq entry-start (point))
1070 (re-search-forward "\^M\\|\n" nil t)
1071 (while (looking-at " \\|\^I")
1072 (re-search-forward "\^M\\|\n" nil t))
1074 (setq entry (buffer-substring-no-properties entry-start (point)))
1075 (while (string-match "[\^M]" entry)
1076 (aset entry (match-beginning 0) ?\n )))
1077 (let ((diary-entry (diary-sexp-entry sexp entry date)))
1079 (subst-char-in-region line-start (point) ?\^M ?\n t))
1080 (add-to-diary-list date diary-entry)
1081 (setq entry-found (or entry-found diary-entry)))))
1084 (defun diary-sexp-entry (sexp entry date)
1085 "Process a SEXP diary ENTRY for DATE."
1086 (let ((result (if calendar-debug-sexp
1087 (let ((stack-trace-on-error t))
1088 (eval (car (read-from-string sexp))))
1090 (eval (car (read-from-string sexp)))
1093 (message "Bad sexp at line %d in %s: %s"
1096 (narrow-to-region 1 (point))
1097 (goto-char (point-min))
1099 (while (re-search-forward "\n\\|\^M" nil t)
1100 (setq lines (1+ lines)))
1104 (if (stringp result)
1110 (defun diary-date (month day year)
1111 "Specific date(s) diary entry.
1112 Entry applies if date is MONTH, DAY, YEAR if `european-calendar-style' is nil,
1113 and DAY, MONTH, YEAR if `european-calendar-style' is t. DAY, MONTH, and YEAR
1114 can be lists of integers, the constant t, or an integer. The constant t means
1116 (let* ((dd (if european-calendar-style
1119 (mm (if european-calendar-style
1122 (m (extract-calendar-month date))
1123 (y (extract-calendar-year date))
1124 (d (extract-calendar-day date)))
1126 (or (and (listp dd) (memq d dd))
1129 (or (and (listp mm) (memq m mm))
1132 (or (and (listp year) (memq y year))
1137 (defun diary-block (m1 d1 y1 m2 d2 y2)
1139 Entry applies if date is between two dates. Order of the parameters is
1140 M1, D1, Y1, M2, D2, Y2 `european-calendar-style' is nil, and
1141 D1, M1, Y1, D2, M2, Y2 if `european-calendar-style' is t."
1142 (let ((date1 (calendar-absolute-from-gregorian
1143 (if european-calendar-style
1146 (date2 (calendar-absolute-from-gregorian
1147 (if european-calendar-style
1150 (d (calendar-absolute-from-gregorian date)))
1151 (if (and (<= date1 d) (<= d date2))
1154 (defun diary-float (month dayname n)
1155 "Floating diary entry--entry applies if date is the nth dayname of month.
1156 Parameters are MONTH, DAYNAME, N. MONTH can be a list of months, the constant
1157 t, or an integer. The constant t means all months. If N is negative, count
1158 backward from the end of the month."
1159 (let ((m (extract-calendar-month date))
1160 (y (extract-calendar-year date)))
1162 (or (and (listp month) (memq m month))
1165 (calendar-date-equal date (calendar-nth-named-day n dayname m y)))
1168 (defun diary-anniversary (month day year)
1169 "Anniversary diary entry.
1170 Entry applies if date is the anniversary of MONTH, DAY, YEAR if
1171 `european-calendar-style' is nil, and DAY, MONTH, YEAR if
1172 `european-calendar-style' is t. Diary entry can contain `%d' or `%d%s'; the
1173 %d will be replaced by the number of years since the MONTH DAY, YEAR and the
1174 %s will be replaced by the ordinal ending of that number (that is, `st', `nd',
1175 `rd' or `th', as appropriate. The anniversary of February 29 is considered
1176 to be March 1 in non-leap years."
1177 (let* ((d (if european-calendar-style
1180 (m (if european-calendar-style
1183 (y (extract-calendar-year date))
1185 (if (and (= m 2) (= d 29) (not (calendar-leap-year-p y)))
1188 (if (and (> diff 0) (calendar-date-equal (list m d y) date))
1189 (format entry diff (diary-ordinal-suffix diff)))))
1191 (defun diary-cyclic (n month day year)
1192 "Cycle diary entry--entry applies every N days starting at MONTH, DAY, YEAR.
1193 If `european-calendar-style' is t, parameters are N, DAY, MONTH, YEAR.
1194 ENTRY can contain `%d' or `%d%s'; the %d will be replaced by the number of
1195 years since the MONTH DAY, YEAR and the %s will be replaced by the ordinal
1196 ending of that number (that is, `st', `nd', `rd' or `th', as appropriate."
1197 (let* ((d (if european-calendar-style
1200 (m (if european-calendar-style
1203 (diff (- (calendar-absolute-from-gregorian date)
1204 (calendar-absolute-from-gregorian
1207 (if (and (>= diff 0) (zerop (% diff n)))
1208 (format entry cycle (diary-ordinal-suffix cycle)))))
1210 (defun diary-ordinal-suffix (n)
1211 "Ordinal suffix for N. (That is, `st', `nd', `rd', or `th', as appropriate.)"
1212 (if (or (memq (% n 100) '(11 12 13))
1215 (aref ["th" "st" "nd" "rd"] (% n 10))))
1217 (defun diary-day-of-year ()
1218 "Day of year and number of days remaining in the year of date diary entry."
1219 (calendar-day-of-year-string date))
1221 (defvar diary-remind-message
1223 (if (= 0 (% days 7))
1224 (concat (int-to-string (/ days 7)) (if (= 7 days) " week" " weeks"))
1225 (concat (int-to-string days) (if (= 1 days) " day" " days")))
1228 "*Pseudo-pattern giving form of reminder messages in the fancy diary
1231 Used by the function `diary-remind', a pseudo-pattern is a list of
1232 expressions that can involve the keywords `days' (a number), `date' (a list of
1233 month, day, year), and `diary-entry' (a string).")
1235 (defun diary-remind (sexp days &optional marking)
1236 "Provide a reminder of a diary entry.
1237 SEXP is a diary-sexp. DAYS is either a single number or a list of numbers
1238 indicating the number(s) of days before the event that the warning(s) should
1239 occur on. If the current date is (one of) DAYS before the event indicated by
1240 SEXP, then a suitable message (as specified by `diary-remind-message' is
1243 In addition to the reminders beforehand, the diary entry also appears on
1246 If optional parameter MARKING is non-nil then the reminders are marked on the
1247 calendar. Marking of reminders is independent of whether the entry itself is
1248 a marking or nonmarking one."
1249 (let ((diary-entry))
1250 (if (or (not marking-diary-entries) marking)
1253 (let ((date (calendar-gregorian-from-absolute
1254 (+ (calendar-absolute-from-gregorian date) days))))
1255 (if (setq diary-entry (eval sexp))
1256 (setq diary-entry (mapconcat 'eval diary-remind-message "")))))
1257 ((and (listp days) days)
1258 (setq diary-entry (diary-remind sexp (car days) marking))
1259 (if (not diary-entry)
1260 (setq diary-entry (diary-remind sexp (cdr days) marking))))))
1262 (and (or (not marking-diary-entries) marking-diary-entry)
1265 (defun add-to-diary-list (date string)
1266 "Add the entry (DATE STRING) to `diary-entries-list'.
1267 Do nothing if DATE or STRING is nil."
1269 (setq diary-entries-list
1270 (append diary-entries-list (list (list date string))))))
1272 (defun make-diary-entry (string &optional nonmarking file)
1273 "Insert a diary entry STRING which may be NONMARKING in FILE.
1274 If omitted, NONMARKING defaults to nil and FILE defaults to diary-file."
1275 (find-file-other-window
1276 (substitute-in-file-name (if file file diary-file)))
1277 (goto-char (point-max))
1280 (if nonmarking diary-nonmarking-symbol "")
1283 (defun insert-diary-entry (arg)
1284 "Insert a diary entry for the date indicated by point.
1285 Prefix arg will make the entry nonmarking."
1287 (make-diary-entry (calendar-date-string (calendar-cursor-to-date t) t t)
1290 (defun insert-weekly-diary-entry (arg)
1291 "Insert a weekly diary entry for the day of the week indicated by point.
1292 Prefix arg will make the entry nonmarking."
1294 (make-diary-entry (calendar-day-name (calendar-cursor-to-date t))
1297 (defun insert-monthly-diary-entry (arg)
1298 "Insert a monthly diary entry for the day of the month indicated by point.
1299 Prefix arg will make the entry nonmarking."
1301 (let* ((calendar-date-display-form
1302 (if european-calendar-style
1305 (make-diary-entry (calendar-date-string (calendar-cursor-to-date t) t)
1308 (defun insert-yearly-diary-entry (arg)
1309 "Insert an annual diary entry for the day of the year indicated by point.
1310 Prefix arg will make the entry nonmarking."
1312 (let* ((calendar-date-display-form
1313 (if european-calendar-style
1314 '(day " " monthname)
1315 '(monthname " " day))))
1316 (make-diary-entry (calendar-date-string (calendar-cursor-to-date t) t)
1319 (defun insert-anniversary-diary-entry (arg)
1320 "Insert an anniversary diary entry for the date given by point.
1321 Prefix arg will make the entry nonmarking."
1323 (let* ((calendar-date-display-form
1324 (if european-calendar-style
1325 '(day " " month " " year)
1326 '(month " " day " " year))))
1328 (format "%s(diary-anniversary %s)"
1329 sexp-diary-entry-symbol
1330 (calendar-date-string (calendar-cursor-to-date t) nil t))
1333 (defun insert-block-diary-entry (arg)
1334 "Insert a block diary entry for the days between the point and marked date.
1335 Prefix arg will make the entry nonmarking."
1337 (let* ((calendar-date-display-form
1338 (if european-calendar-style
1339 '(day " " month " " year)
1340 '(month " " day " " year)))
1341 (cursor (calendar-cursor-to-date t))
1342 (mark (or (car calendar-mark-ring)
1343 (error "No mark set in this buffer")))
1346 (if (< (calendar-absolute-from-gregorian mark)
1347 (calendar-absolute-from-gregorian cursor))
1353 (format "%s(diary-block %s %s)"
1354 sexp-diary-entry-symbol
1355 (calendar-date-string start nil t)
1356 (calendar-date-string end nil t))
1359 (defun insert-cyclic-diary-entry (arg)
1360 "Insert a cyclic diary entry starting at the date given by point.
1361 Prefix arg will make the entry nonmarking."
1363 (let* ((calendar-date-display-form
1364 (if european-calendar-style
1365 '(day " " month " " year)
1366 '(month " " day " " year))))
1368 (format "%s(diary-cyclic %d %s)"
1369 sexp-diary-entry-symbol
1370 (calendar-read "Repeat every how many days: "
1371 '(lambda (x) (> x 0)))
1372 (calendar-date-string (calendar-cursor-to-date t) nil t))
1375 (provide 'diary-lib)
1377 ;;; diary-lib.el ends here