aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorGlenn Morris2008-04-06 20:53:14 +0000
committerGlenn Morris2008-04-06 20:53:14 +0000
commitefe9409ae0b2c8812fd85053863ffbb6806488c1 (patch)
tree997c5f48f7105a02aa9fa8cc4d0b270339a62354 /lisp
parent8c34d83efa3bc9a6549dafdcd5e3fe5ba96724e2 (diff)
downloademacs-efe9409ae0b2c8812fd85053863ffbb6806488c1.tar.gz
emacs-efe9409ae0b2c8812fd85053863ffbb6806488c1.zip
(diary-sexp-entry-symbol): Rename sexp-diary-entry-symbol.
Keep old name as alias, update users. (diary-list-entries-hook): Rename list-diary-entries-hook. Keep old name as alias, update users. (diary-mark-entries-hook): Rename mark-diary-entries-hook. Keep old name as alias, update users. (diary-nongregorian-listing-hook): Rename nongregorian-diary-listing-hook. Keep old name as alias, update users. (diary-nongregorian-marking-hook): Rename nongregorian-diary-marking-hook. Keep old name as alias, update users. (diary-print-entries-hook): Rename print-diary-entries-hook. Keep old name as alias, update users. (diary-abbreviated-year-flag): Rename abbreviated-calendar-year. Keep old name as alias, update users. (diary-number-of-entries): Rename number-of-diary-entries. Keep old name as alias, update users. (view-diary-entries, list-diary-entries, show-all-diary-entries): Give version of obsolescence. (diary-view-other-diary-entries): Rename view-other-diary-entries. Keep old name as alias, update callers. (diary-add-to-list): Rename add-to-diary-list. Keep old name as alias, update callers. (diary-include-other-diary-files): Rename include-other-diary-files. Keep old name as alias, update callers. (diary-simple-display): Rename simple-diary-display. Keep old name as alias, update callers. (diary-fancy-display): Rename fancy-diary-display. Keep old name as alias, update callers. (diary-print-entries): Rename print-diary-entries. Keep old name as alias, update callers. (diary-marking-entries-flag): Rename marking-diary-entries. Update users. (diary-marking-entry-flag): Rename marking-diary-entry. Update users. (diary-mark-entries): Rename mark-diary-entries. Keep old name as alias, update callers. (diary-mark-sexp-entries): Rename mark-sexp-diary-entries. Keep old name as alias, update callers. (diary-mark-included-diary-files): Rename mark-included-diary-files. Keep old name as alias, update callers. (calendar-mark-days-named): Rename mark-calendar-days-named. Keep old name as alias, update callers. (calendar-mark-month): Rename mark-calendar-month. Keep old name as alias, update callers. (calendar-mark-date-pattern): Rename mark-calendar-date-pattern. Keep old name as alias, update callers. (diary-sort-entries): Rename sort-diary-entries. Keep old name as alias, update callers. (diary-list-sexp-entries): Rename list-sexp-diary-entries. Keep old name as alias, update callers. (diary-make-entry): Rename make-diary-entry. Keep old name as alias, update callers. (diary-insert-entry): Rename insert-diary-entry. Keep old name as alias. (diary-insert-weekly-entry): Rename insert-weekly-diary-entry. Keep old name as alias. (diary-insert-monthly-entry): Rename insert-monthly-diary-entry. Keep old name as alias. (diary-insert-yearly-entry): Rename insert-yearly-diary-entry. Keep old name as alias. (diary-insert-anniversary-entry): Rename insert-anniversary-diary-entry. Keep old name as alias. (diary-insert-block-entry): Rename insert-block-diary-entry. Keep old name as alias. (diary-insert-cyclic-entry): Rename insert-cyclic-diary-entry. Keep old name as alias. (diary-fancy-font-lock-keywords): Rename fancy-diary-font-lock-keywords. Keep old name as alias, update users. (diary-fancy-display-mode): Rename fancy-diary-display-mode. Keep old name as alias, update callers.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/calendar/diary-lib.el334
1 files changed, 217 insertions, 117 deletions
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index 6707bf1d5bf..c370deaf3fc 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -35,7 +35,7 @@
35 35
36(defcustom diary-include-string "#include" 36(defcustom diary-include-string "#include"
37 "The string indicating inclusion of another file of diary entries. 37 "The string indicating inclusion of another file of diary entries.
38See the documentation for the function `include-other-diary-files'." 38See the documentation for the function `diary-include-other-diary-files'."
39 :type 'string 39 :type 'string
40 :group 'diary) 40 :group 'diary)
41 41
@@ -130,39 +130,48 @@ are: `string', `symbol', `int', `tnil',`stringtnil.'"
130 :type 'function 130 :type 'function
131 :group 'diary) 131 :group 'diary)
132 132
133(defcustom sexp-diary-entry-symbol "%%" 133(defcustom diary-sexp-entry-symbol "%%"
134 "The string used to indicate a sexp diary entry in `diary-file'. 134 "The string used to indicate a sexp diary entry in `diary-file'.
135See the documentation for the function `list-sexp-diary-entries'." 135See the documentation for the function `diary-list-sexp-entries'."
136 :type 'string 136 :type 'string
137 :group 'diary) 137 :group 'diary)
138 138
139(defcustom list-diary-entries-hook nil 139(define-obsolete-variable-alias 'sexp-diary-entry-symbol
140 'diary-sexp-entry-symbol "23.1")
141
142(defcustom diary-list-entries-hook nil
140 "List of functions called after diary file is culled for relevant entries. 143 "List of functions called after diary file is culled for relevant entries.
141You might wish to add `include-other-diary-files', in which case 144You might wish to add `diary-include-other-diary-files', in which case
142you will probably also want to add `mark-included-diary-files' to 145you will probably also want to add `diary-mark-included-diary-files' to
143`mark-diary-entries-hook'. For example, you could use 146`diary-mark-entries-hook'. For example, you could use
144 147
145 (add-hook 'list-diary-entries-hook 'include-other-diary-files) 148 (add-hook 'diary-list-entries-hook 'diary-include-other-diary-files)
146 (add-hook 'list-diary-entries-hook 'sort-diary-entries) 149 (add-hook 'diary-list-entries-hook 'diary-sort-entries)
147 (add-hook 'diary-display-hook 'fancy-diary-display) 150 (add-hook 'diary-display-hook 'diary-fancy-display)
148 151
149in your `.emacs' file to cause the fancy diary buffer to be displayed with 152in your `.emacs' file to cause the fancy diary buffer to be displayed with
150diary entries from various included files, each day's entries sorted into 153diary entries from various included files, each day's entries sorted into
151lexicographic order." 154lexicographic order."
152 :type 'hook 155 :type 'hook
153 :options '(include-other-diary-files sort-diary-entries) 156 :options '(diary-include-other-diary-files diary-sort-entries)
154 :group 'diary) 157 :group 'diary)
155 158
156(defcustom mark-diary-entries-hook nil 159(define-obsolete-variable-alias 'list-diary-entries-hook
160 'diary-list-entries-hook "23.1")
161
162(defcustom diary-mark-entries-hook nil
157 "List of functions called after marking diary entries in the calendar. 163 "List of functions called after marking diary entries in the calendar.
158You might wish to add `mark-included-diary-files', in which case 164You might wish to add `diary-mark-included-diary-files', in which case
159you will probably also want to add `include-other-diary-files' to 165you will probably also want to add `diary-include-other-diary-files' to
160`list-diary-entries-hook'." 166`diary-list-entries-hook'."
161 :type 'hook 167 :type 'hook
162 :options '(mark-included-diary-files) 168 :options '(diary-mark-included-diary-files)
163 :group 'diary) 169 :group 'diary)
164 170
165(defcustom nongregorian-diary-listing-hook nil 171(define-obsolete-variable-alias 'mark-diary-entries-hook
172 'diary-mark-entries-hook "23.1")
173
174(defcustom diary-nongregorian-listing-hook nil
166 "List of functions called for listing diary file and included files. 175 "List of functions called for listing diary file and included files.
167As the files are processed for diary entries, these functions are used 176As the files are processed for diary entries, these functions are used
168to cull relevant entries. You can use any or all of 177to cull relevant entries. You can use any or all of
@@ -175,7 +184,10 @@ describes the style of such diary entries."
175 diary-islamic-list-entries) 184 diary-islamic-list-entries)
176 :group 'diary) 185 :group 'diary)
177 186
178(defcustom nongregorian-diary-marking-hook nil 187(define-obsolete-variable-alias 'nongregorian-diary-listing-hook
188 'diary-nongregorian-listing-hook "23.1")
189
190(defcustom diary-nongregorian-marking-hook nil
179 "List of functions called for marking diary file and included files. 191 "List of functions called for marking diary file and included files.
180As the files are processed for diary entries, these functions are used 192As the files are processed for diary entries, these functions are used
181to cull relevant entries. You can use any or all of 193to cull relevant entries. You can use any or all of
@@ -188,8 +200,11 @@ describes the style of such diary entries."
188 diary-islamic-mark-entries) 200 diary-islamic-mark-entries)
189 :group 'diary) 201 :group 'diary)
190 202
191(defcustom print-diary-entries-hook 'lpr-buffer 203(define-obsolete-variable-alias 'nongregorian-diary-marking-hook
192 "Run by `print-diary-entries' after preparing a temporary diary buffer. 204 'diary-nongregorian-marking-hook "23.1")
205
206(defcustom diary-print-entries-hook 'lpr-buffer
207 "Run by `diary-print-entries' after preparing a temporary diary buffer.
193The buffer shows only the diary entries currently visible in the 208The buffer shows only the diary entries currently visible in the
194diary buffer. The default just does the printing. Other uses 209diary buffer. The default just does the printing. Other uses
195might include, for example, rearranging the lines into order by 210might include, for example, rearranging the lines into order by
@@ -198,6 +213,9 @@ changing the function used to do the printing."
198 :type 'hook 213 :type 'hook
199 :group 'diary) 214 :group 'diary)
200 215
216(define-obsolete-variable-alias 'print-diary-entries-hook
217 'diary-print-entries-hook "23.1")
218
201(defcustom diary-unknown-time -9999 219(defcustom diary-unknown-time -9999
202 "Value returned by `diary-entry-time' when no time is found. 220 "Value returned by `diary-entry-time' when no time is found.
203The default value -9999 causes entries with no recognizable time 221The default value -9999 causes entries with no recognizable time
@@ -235,7 +253,7 @@ month, day, year), and `diary-entry' (a string)."
235 :type 'sexp 253 :type 'sexp
236 :group 'diary) 254 :group 'diary)
237 255
238(defcustom abbreviated-calendar-year t 256(defcustom diary-abbreviated-year-flag t
239 "Interpret a two-digit year DD in a diary entry as either 19DD or 20DD. 257 "Interpret a two-digit year DD in a diary entry as either 19DD or 20DD.
240This applies to the Gregorian, Hebrew, Islamic, and Baha'i calendars. 258This applies to the Gregorian, Hebrew, Islamic, and Baha'i calendars.
241When the current century is added to a two-digit year, if the result 259When the current century is added to a two-digit year, if the result
@@ -245,6 +263,9 @@ If this variable is nil, years must be written in full."
245 :type 'boolean 263 :type 'boolean
246 :group 'diary) 264 :group 'diary)
247 265
266(define-obsolete-variable-alias 'abbreviated-calendar-year
267 'diary-abbreviated-year-flag "23.1")
268
248(defcustom diary-outlook-formats 269(defcustom diary-outlook-formats
249 '( 270 '(
250 ;; When: 11 October 2001 12:00-14:00 (GMT) Greenwich Mean Time : Dublin, ... 271 ;; When: 11 October 2001 12:00-14:00 (GMT) Greenwich Mean Time : Dublin, ...
@@ -310,7 +331,7 @@ template following the rules above."
310;; This can be removed once the kill/yank treatment of invisible text 331;; This can be removed once the kill/yank treatment of invisible text
311;; (see etc/TODO) is fixed. -- gm 332;; (see etc/TODO) is fixed. -- gm
312(defcustom diary-header-line-flag t 333(defcustom diary-header-line-flag t
313 "Non-nil means `simple-diary-display' will show a header line. 334 "Non-nil means `diary-simple-display' will show a header line.
314The format of the header is specified by `diary-header-line-format'." 335The format of the header is specified by `diary-header-line-format'."
315 :group 'diary 336 :group 'diary
316 :type 'boolean 337 :type 'boolean
@@ -328,7 +349,7 @@ The format of the header is specified by `diary-header-line-format'."
328before edit/copy" 349before edit/copy"
329 "Diary")) 350 "Diary"))
330 ?\s (frame-width))) 351 ?\s (frame-width)))
331 "Format of the header line displayed by `simple-diary-display'. 352 "Format of the header line displayed by `diary-simple-display'.
332Only used if `diary-header-line-flag' is non-nil." 353Only used if `diary-header-line-flag' is non-nil."
333 :group 'diary 354 :group 'diary
334 :type 'sexp 355 :type 'sexp
@@ -366,7 +387,7 @@ just visiting the `diary-file'), and SYMBOL's value is to be changed."
366 ;; Note this assumes diary was called without prefix arg. 387 ;; Note this assumes diary was called without prefix arg.
367 (diary)))) 388 (diary))))
368 389
369(defcustom number-of-diary-entries 1 390(defcustom diary-number-of-entries 1
370 "Specifies how many days of diary entries are to be displayed initially. 391 "Specifies how many days of diary entries are to be displayed initially.
371This variable affects the diary display when the command \\[diary] is used, 392This variable affects the diary display when the command \\[diary] is used,
372or if the value of the variable `view-diary-entries-initially' is non-nil. 393or if the value of the variable `view-diary-entries-initially' is non-nil.
@@ -396,6 +417,9 @@ number of days of diary entries displayed."
396 :set 'diary-set-maybe-redraw 417 :set 'diary-set-maybe-redraw
397 :group 'diary) 418 :group 'diary)
398 419
420(define-obsolete-variable-alias 'number-of-diary-entries
421 'diary-number-of-entries "23.1")
422
399;;; More user options in calendar.el. 423;;; More user options in calendar.el.
400 424
401 425
@@ -413,7 +437,7 @@ If so, return the expanded file name, otherwise signal an error."
413(defun diary (&optional arg) 437(defun diary (&optional arg)
414 "Generate the diary window for ARG days starting with the current date. 438 "Generate the diary window for ARG days starting with the current date.
415If no argument is provided, the number of days of diary entries is governed 439If no argument is provided, the number of days of diary entries is governed
416by the variable `number-of-diary-entries'. A value of ARG less than 1 440by the variable `diary-number-of-entries'. A value of ARG less than 1
417does nothing. This function is suitable for execution in a `.emacs' file." 441does nothing. This function is suitable for execution in a `.emacs' file."
418 (interactive "P") 442 (interactive "P")
419 (diary-check-diary-file) 443 (diary-check-diary-file)
@@ -430,11 +454,11 @@ in the displayed three-month calendar."
430 (diary-check-diary-file) 454 (diary-check-diary-file)
431 (diary-list-entries (calendar-cursor-to-date t) arg)) 455 (diary-list-entries (calendar-cursor-to-date t) arg))
432 456
433(define-obsolete-function-alias 'view-diary-entries 'diary-view-entries) 457(define-obsolete-function-alias 'view-diary-entries 'diary-view-entries "22.1")
434 458
435 459
436;;;###cal-autoload 460;;;###cal-autoload
437(defun view-other-diary-entries (arg dfile) 461(defun diary-view-other-diary-entries (arg dfile)
438 "Prepare and display buffer of diary entries from an alternative diary file. 462 "Prepare and display buffer of diary entries from an alternative diary file.
439Searches for entries that match ARG days, starting with the date indicated 463Searches for entries that match ARG days, starting with the date indicated
440by the cursor position in the displayed three-month calendar. 464by the cursor position in the displayed three-month calendar.
@@ -445,6 +469,10 @@ DFILE specifies the file to use as the diary file."
445 (let ((diary-file dfile)) 469 (let ((diary-file dfile))
446 (diary-view-entries arg))) 470 (diary-view-entries arg)))
447 471
472;;;###cal-autoload
473(define-obsolete-function-alias 'view-other-diary-entries
474 'diary-view-other-diary-entries "23.1")
475
448(defvar diary-syntax-table 476(defvar diary-syntax-table
449 (let ((st (copy-syntax-table (standard-syntax-table)))) 477 (let ((st (copy-syntax-table (standard-syntax-table))))
450 (modify-syntax-entry ?* "w" st) 478 (modify-syntax-entry ?* "w" st)
@@ -518,7 +546,7 @@ The function takes a string argument and must return a string.")
518 546
519(defvar diary-entries-list) ; bound in diary-list-entries 547(defvar diary-entries-list) ; bound in diary-list-entries
520 548
521(defun add-to-diary-list (date string specifier &optional marker 549(defun diary-add-to-list (date string specifier &optional marker
522 globcolor literal) 550 globcolor literal)
523 "Add an entry to `diary-entries-list'. 551 "Add an entry to `diary-entries-list'.
524Do nothing if DATE or STRING is nil. DATE is the (MONTH DAY 552Do nothing if DATE or STRING is nil. DATE is the (MONTH DAY
@@ -547,6 +575,8 @@ FILENAME being the file containing the diary entry."
547 (list marker (buffer-file-name) literal) 575 (list marker (buffer-file-name) literal)
548 globcolor)))))) 576 globcolor))))))
549 577
578(define-obsolete-function-alias 'add-to-diary-list 'diary-add-to-list "23.1")
579
550(defun diary-list-entries-2 (date mark globattr list-only 580(defun diary-list-entries-2 (date mark globattr list-only
551 &optional months symbol) 581 &optional months symbol)
552 "Internal subroutine of `diary-list-entries'. 582 "Internal subroutine of `diary-list-entries'.
@@ -570,7 +600,7 @@ entries of the desired type. Returns non-nil if any entries were found."
570 (month (format "\\*\\|0*%d" month)) 600 (month (format "\\*\\|0*%d" month))
571 (day (format "\\*\\|0*%d" day)) 601 (day (format "\\*\\|0*%d" day))
572 (year (format "\\*\\|0*%d%s" year 602 (year (format "\\*\\|0*%d%s" year
573 (if abbreviated-calendar-year 603 (if diary-abbreviated-year-flag
574 (format "\\|%02d" (% year 100)) 604 (format "\\|%02d" (% year 100))
575 ""))) 605 "")))
576 (case-fold-search t) 606 (case-fold-search t)
@@ -609,7 +639,7 @@ entries of the desired type. Returns non-nil if any entries were found."
609 (setq temp (diary-pull-attrs 639 (setq temp (diary-pull-attrs
610 (buffer-substring-no-properties 640 (buffer-substring-no-properties
611 entry-start (point)) globattr)) 641 entry-start (point)) globattr))
612 (add-to-diary-list 642 (diary-add-to-list
613 date (car temp) 643 date (car temp)
614 (buffer-substring-no-properties (1+ date-start) (1- entry-start)) 644 (buffer-substring-no-properties (1+ date-start) (1- entry-start))
615 (copy-marker entry-start) (cadr temp)))))) 645 (copy-marker entry-start) (cadr temp))))))
@@ -636,7 +666,6 @@ of the appropriate type."
636 (goto-char (point-min))) 666 (goto-char (point-min)))
637 667
638;; FIXME non-greg and list hooks run same number of times? 668;; FIXME non-greg and list hooks run same number of times?
639(define-obsolete-function-alias 'list-diary-entries 'diary-list-entries)
640(defun diary-list-entries (date number &optional list-only) 669(defun diary-list-entries (date number &optional list-only)
641 "Create and display a buffer containing the relevant lines in `diary-file'. 670 "Create and display a buffer containing the relevant lines in `diary-file'.
642The arguments are DATE and NUMBER; the entries selected are those 671The arguments are DATE and NUMBER; the entries selected are those
@@ -652,31 +681,31 @@ string for a date with no diary entries.
652 681
653After the list is prepared, the following hooks are run: 682After the list is prepared, the following hooks are run:
654 683
655 `nongregorian-diary-listing-hook' can cull dates from the diary 684 `diary-nongregorian-listing-hook' can cull dates from the diary
656 and each included file, for example to process Islamic diary 685 and each included file, for example to process Islamic diary
657 entries. Applied to *each* file. 686 entries. Applied to *each* file.
658 687
659 `list-diary-entries-hook' adds or manipulates diary entries from 688 `diary-list-entries-hook' adds or manipulates diary entries from
660 external sources. Used, for example, to include diary entries 689 external sources. Used, for example, to include diary entries
661 from other files or to sort the diary entries. Invoked *once* 690 from other files or to sort the diary entries. Invoked *once*
662 only, before the display hook is run. 691 only, before the display hook is run.
663 692
664 `diary-display-hook' does the actual display of information. If nil, 693 `diary-display-hook' does the actual display of information. If nil,
665 `simple-diary-display' is used. Use `add-hook' to use 694 `diary-simple-display' is used. Use `add-hook' to use
666 `fancy-diary-display', if desired, or `ignore' for no display. 695 `diary-fancy-display', if desired, or `ignore' for no display.
667 696
668 `diary-hook' is run last. This is used e.g. by `appt-check'. 697 `diary-hook' is run last. This is used e.g. by `appt-check'.
669 698
670Functions called by these hooks may use the variables ORIGINAL-DATE 699Functions called by these hooks may use the variables ORIGINAL-DATE
671and NUMBER, which are the arguments with which this function was called. 700and NUMBER, which are the arguments with which this function was called.
672Note that hook functions should _not_ use DATE, but ORIGINAL-DATE. 701Note that hook functions should _not_ use DATE, but ORIGINAL-DATE.
673\(Sexp diary entries may use DATE - see `list-sexp-diary-entries'.) 702\(Sexp diary entries may use DATE - see `diary-list-sexp-entries'.)
674 703
675If LIST-ONLY is non-nil don't modify or display the buffer, only return a list." 704If LIST-ONLY is non-nil don't modify or display the buffer, only return a list."
676 (unless number 705 (unless number
677 (setq number (if (vectorp number-of-diary-entries) 706 (setq number (if (vectorp diary-number-of-entries)
678 (aref number-of-diary-entries (calendar-day-of-week date)) 707 (aref diary-number-of-entries (calendar-day-of-week date))
679 number-of-diary-entries))) 708 diary-number-of-entries)))
680 (when (> number 0) 709 (when (> number 0)
681 (let* ((original-date date) ; save for possible use in the hooks 710 (let* ((original-date date) ; save for possible use in the hooks
682 (date-string (calendar-date-string date)) 711 (date-string (calendar-date-string date))
@@ -714,26 +743,28 @@ If LIST-ONLY is non-nil don't modify or display the buffer, only return a list."
714 (overlay-put ol 'invisible 'diary) 743 (overlay-put ol 'invisible 'diary)
715 (overlay-put ol 'evaporate t))) 744 (overlay-put ol 'evaporate t)))
716 (dotimes (idummy number) 745 (dotimes (idummy number)
717 (let ((sexp-found (list-sexp-diary-entries date)) 746 (let ((sexp-found (diary-list-sexp-entries date))
718 (entry-found (diary-list-entries-2 747 (entry-found (diary-list-entries-2
719 date diary-nonmarking-symbol 748 date diary-nonmarking-symbol
720 file-glob-attrs list-only))) 749 file-glob-attrs list-only)))
721 (if diary-list-include-blanks 750 (if diary-list-include-blanks
722 (or sexp-found entry-found 751 (or sexp-found entry-found
723 (add-to-diary-list date "" "" "" ""))) 752 (diary-add-to-list date "" "" "" "")))
724 (setq date 753 (setq date
725 (calendar-gregorian-from-absolute 754 (calendar-gregorian-from-absolute
726 (1+ (calendar-absolute-from-gregorian date))))))) 755 (1+ (calendar-absolute-from-gregorian date)))))))
727 (goto-char (point-min)) 756 (goto-char (point-min))
728 (run-hooks 'nongregorian-diary-listing-hook 757 (run-hooks 'diary-nongregorian-listing-hook
729 'list-diary-entries-hook) 758 'diary-list-entries-hook)
730 (unless list-only 759 (unless list-only
731 (if diary-display-hook 760 (if diary-display-hook
732 (run-hooks 'diary-display-hook) 761 (run-hooks 'diary-display-hook)
733 (simple-diary-display))) 762 (diary-simple-display)))
734 (run-hooks 'diary-hook) 763 (run-hooks 'diary-hook)
735 diary-entries-list)))))) 764 diary-entries-list))))))
736 765
766(define-obsolete-function-alias 'list-diary-entries 'diary-list-entries "22.1")
767
737(defun diary-unhide-everything () 768(defun diary-unhide-everything ()
738 "Show all invisible text in the diary." 769 "Show all invisible text in the diary."
739 (kill-local-variable 'diary-selective-display) 770 (kill-local-variable 'diary-selective-display)
@@ -743,9 +774,9 @@ If LIST-ONLY is non-nil don't modify or display the buffer, only return a list."
743(defvar original-date) ; bound in diary-list-entries 774(defvar original-date) ; bound in diary-list-entries
744(defvar number) 775(defvar number)
745 776
746(defun include-other-diary-files () 777(defun diary-include-other-diary-files ()
747 "Include the diary entries from other diary files with those of `diary-file'. 778 "Include the diary entries from other diary files with those of `diary-file'.
748This function is suitable for use with `list-diary-entries-hook'; 779This function is suitable for use with `diary-list-entries-hook';
749it enables you to use shared diary files together with your own. 780it enables you to use shared diary files together with your own.
750The files included are specified in the `diary-file' by lines of this form: 781The files included are specified in the `diary-file' by lines of this form:
751 #include \"filename\" 782 #include \"filename\"
@@ -759,7 +790,7 @@ changing the variable `diary-include-string'."
759 (let ((diary-file (substitute-in-file-name 790 (let ((diary-file (substitute-in-file-name
760 (match-string-no-properties 1))) 791 (match-string-no-properties 1)))
761 (diary-list-include-blanks nil) 792 (diary-list-include-blanks nil)
762 (list-diary-entries-hook 'include-other-diary-files) 793 (diary-list-entries-hook 'diary-include-other-diary-files)
763 (diary-display-hook 'ignore) 794 (diary-display-hook 'ignore)
764 (diary-hook nil)) 795 (diary-hook nil))
765 (if (file-exists-p diary-file) 796 (if (file-exists-p diary-file)
@@ -778,10 +809,13 @@ changing the variable `diary-include-string'."
778 (sleep-for 2)))) 809 (sleep-for 2))))
779 (goto-char (point-min))) 810 (goto-char (point-min)))
780 811
812(define-obsolete-function-alias 'include-other-diary-files
813 'diary-include-other-diary-files "23.1")
814
781(defvar date-string) ; bound in diary-list-entries 815(defvar date-string) ; bound in diary-list-entries
782 816
783(defun diary-display-no-entries () 817(defun diary-display-no-entries ()
784 "Common subroutine of `simple-diary-display' and `fancy-diary-display'. 818 "Common subroutine of `diary-simple-display' and `diary-fancy-display'.
785Handles the case where there are no diary entries. 819Handles the case where there are no diary entries.
786Returns a cons (NOENTRIES . HOLIDAY-STRING)." 820Returns a cons (NOENTRIES . HOLIDAY-STRING)."
787 (let* ((holiday-list (if holidays-in-diary-buffer 821 (let* ((holiday-list (if holidays-in-diary-buffer
@@ -813,7 +847,7 @@ Returns a cons (NOENTRIES . HOLIDAY-STRING)."
813 847
814(defvar diary-saved-point) ; bound in diary-list-entries 848(defvar diary-saved-point) ; bound in diary-list-entries
815 849
816(defun simple-diary-display () 850(defun diary-simple-display ()
817 "Display the diary buffer if there are any relevant entries or holidays." 851 "Display the diary buffer if there are any relevant entries or holidays."
818 ;; If selected window is dedicated (to the calendar), need a new one 852 ;; If selected window is dedicated (to the calendar), need a new one
819 ;; to display the diary. 853 ;; to display the diary.
@@ -836,6 +870,9 @@ Returns a cons (NOENTRIES . HOLIDAY-STRING)."
836 (set-window-start window (point-min)))) 870 (set-window-start window (point-min))))
837 (message "Preparing diary...done")))) 871 (message "Preparing diary...done"))))
838 872
873(define-obsolete-function-alias 'simple-diary-display
874 'diary-simple-display "23.1")
875
839(define-button-type 'diary-entry 876(define-button-type 'diary-entry
840 'action #'diary-goto-entry 877 'action #'diary-goto-entry
841 'face 'diary-button) 878 'face 'diary-button)
@@ -864,7 +901,7 @@ Returns a cons (NOENTRIES . HOLIDAY-STRING)."
864 (goto-char (match-beginning 1))))) 901 (goto-char (match-beginning 1)))))
865 (message "Unable to locate this diary entry"))))) 902 (message "Unable to locate this diary entry")))))
866 903
867(defun fancy-diary-display () 904(defun diary-fancy-display ()
868 "Prepare a diary buffer with relevant entries in a fancy, noneditable form. 905 "Prepare a diary buffer with relevant entries in a fancy, noneditable form.
869To use this function, add it to `diary-display-hook'." 906To use this function, add it to `diary-display-hook'."
870 ;; Turn off selective-display in the diary file's buffer. 907 ;; Turn off selective-display in the diary file's buffer.
@@ -942,12 +979,15 @@ To use this function, add it to `diary-display-hook'."
942 (overlay-put 979 (overlay-put
943 (make-overlay (match-beginning 0) (match-end 0)) 980 (make-overlay (match-beginning 0) (match-end 0))
944 'face temp-face))))))) 981 'face temp-face)))))))
945 (fancy-diary-display-mode) 982 (diary-fancy-display-mode)
946 (calendar-set-mode-line date-string) 983 (calendar-set-mode-line date-string)
947 (message "Preparing diary...done")))) 984 (message "Preparing diary...done"))))
948 985
986(define-obsolete-function-alias 'fancy-diary-display
987 'diary-fancy-display "23.1")
988
949;; FIXME modernize? 989;; FIXME modernize?
950(defun print-diary-entries () 990(defun diary-print-entries ()
951 "Print a hard copy of the diary display. 991 "Print a hard copy of the diary display.
952 992
953If the simple diary display is being used, prepare a temp buffer with the 993If the simple diary display is being used, prepare a temp buffer with the
@@ -956,14 +996,14 @@ line, print the temp buffer, and destroy it.
956 996
957If the fancy diary display is being used, just print the buffer. 997If the fancy diary display is being used, just print the buffer.
958 998
959The hooks given by the variable `print-diary-entries-hook' are called to do 999The hooks given by the variable `diary-print-entries-hook' are called to do
960the actual printing." 1000the actual printing."
961 (interactive) 1001 (interactive)
962 (let ((diary-buffer (get-buffer fancy-diary-buffer)) 1002 (let ((diary-buffer (get-buffer fancy-diary-buffer))
963 temp-buffer heading start end) 1003 temp-buffer heading start end)
964 (if diary-buffer 1004 (if diary-buffer
965 (with-current-buffer diary-buffer 1005 (with-current-buffer diary-buffer
966 (run-hooks 'print-diary-entries-hook)) 1006 (run-hooks 'diary-print-entries-hook))
967 (or (setq diary-buffer 1007 (or (setq diary-buffer
968 (find-buffer-visiting (substitute-in-file-name diary-file))) 1008 (find-buffer-visiting (substitute-in-file-name diary-file)))
969 (error "You don't have a diary buffer!")) 1009 (error "You don't have a diary buffer!"))
@@ -988,10 +1028,12 @@ the actual printing."
988 (goto-char (point-min)) 1028 (goto-char (point-min))
989 (insert heading "\n" 1029 (insert heading "\n"
990 (make-string (length heading) ?=) "\n") 1030 (make-string (length heading) ?=) "\n")
991 (run-hooks 'print-diary-entries-hook) 1031 (run-hooks 'diary-print-entries-hook)
992 (kill-buffer temp-buffer)))) 1032 (kill-buffer temp-buffer))))
993 1033
994(define-obsolete-function-alias 'show-all-diary-entries 'diary-show-all-entries) 1034(define-obsolete-function-alias 'print-diary-entries
1035 'diary-print-entries "23.1")
1036
995;;;###cal-autoload 1037;;;###cal-autoload
996(defun diary-show-all-entries () 1038(defun diary-show-all-entries ()
997 "Show all of the diary entries in the diary file. 1039 "Show all of the diary entries in the diary file.
@@ -1008,6 +1050,9 @@ is created."
1008 (diary-unhide-everything) 1050 (diary-unhide-everything)
1009 (display-buffer (current-buffer))))) 1051 (display-buffer (current-buffer)))))
1010 1052
1053(define-obsolete-function-alias 'show-all-diary-entries
1054 'diary-show-all-entries "22.1")
1055
1011;;;###autoload 1056;;;###autoload
1012(defun diary-mail-entries (&optional ndays) 1057(defun diary-mail-entries (&optional ndays)
1013 "Send a mail message showing diary entries for next NDAYS days. 1058 "Send a mail message showing diary entries for next NDAYS days.
@@ -1034,7 +1079,7 @@ should ensure that all relevant variables are set.
1034 (interactive "P") 1079 (interactive "P")
1035 (if (string-equal diary-mail-addr "") 1080 (if (string-equal diary-mail-addr "")
1036 (error "You must set `diary-mail-addr' to use this command") 1081 (error "You must set `diary-mail-addr' to use this command")
1037 (let ((diary-display-hook 'fancy-diary-display)) 1082 (let ((diary-display-hook 'diary-fancy-display))
1038 (diary-list-entries (calendar-current-date) (or ndays diary-mail-days))) 1083 (diary-list-entries (calendar-current-date) (or ndays diary-mail-days)))
1039 (compose-mail diary-mail-addr 1084 (compose-mail diary-mail-addr
1040 (concat "Diary entries generated " 1085 (concat "Diary entries generated "
@@ -1063,13 +1108,13 @@ argument PAREN is non-nil, the regexp is surrounded by parentheses."
1063 nil) 1108 nil)
1064 paren)) 1109 paren))
1065 1110
1066(defvar marking-diary-entries nil 1111(defvar diary-marking-entries-flag nil
1067 "True during the marking of diary entries, nil otherwise.") 1112 "True during the marking of diary entries, nil otherwise.")
1068 1113
1069(defvar marking-diary-entry nil 1114(defvar diary-marking-entry-flag nil
1070 "True during the marking of diary entries, if current entry is marking.") 1115 "True during the marking of diary entries, if current entry is marking.")
1071 1116
1072;; file-glob-attrs bound in mark-diary-entries. 1117;; file-glob-attrs bound in diary-mark-entries.
1073(defun diary-mark-entries-1 (markfunc &optional months symbol absfunc) 1118(defun diary-mark-entries-1 (markfunc &optional months symbol absfunc)
1074 "Mark diary entries of a certain type. 1119 "Mark diary entries of a certain type.
1075MARKFUNC is a function that marks entries of the appropriate type 1120MARKFUNC is a function that marks entries of the appropriate type
@@ -1126,7 +1171,7 @@ function that converts absolute dates to dates of the appropriate type. "
1126 (yy (if (not y-str) 1171 (yy (if (not y-str)
1127 0 1172 0
1128 (if (and (= (length y-str) 2) 1173 (if (and (= (length y-str) 2)
1129 abbreviated-calendar-year) 1174 diary-abbreviated-year-flag)
1130 (let* ((current-y 1175 (let* ((current-y
1131 (extract-calendar-year 1176 (extract-calendar-year
1132 (if absfunc 1177 (if absfunc
@@ -1154,7 +1199,7 @@ function that converts absolute dates to dates of the appropriate type. "
1154 (point) (line-end-position)) 1199 (point) (line-end-position))
1155 file-glob-attrs))) 1200 file-glob-attrs)))
1156 (if dd-name 1201 (if dd-name
1157 (mark-calendar-days-named 1202 (calendar-mark-days-named
1158 (cdr (assoc-string dd-name 1203 (cdr (assoc-string dd-name
1159 (calendar-make-alist 1204 (calendar-make-alist
1160 calendar-day-name-array 1205 calendar-day-name-array
@@ -1171,11 +1216,11 @@ function that converts absolute dates to dates of the appropriate type. "
1171 (funcall markfunc mm dd yy marks)))))))) 1216 (funcall markfunc mm dd yy marks))))))))
1172 1217
1173;;;###cal-autoload 1218;;;###cal-autoload
1174(defun mark-diary-entries (&optional redraw) 1219(defun diary-mark-entries (&optional redraw)
1175 "Mark days in the calendar window that have diary entries. 1220 "Mark days in the calendar window that have diary entries.
1176Each entry in the diary file visible in the calendar window is 1221Each entry in the diary file visible in the calendar window is
1177marked. After the entries are marked, the hooks 1222marked. After the entries are marked, the hooks
1178`nongregorian-diary-marking-hook' and `mark-diary-entries-hook' 1223`diary-nongregorian-marking-hook' and `diary-mark-entries-hook'
1179are run. If the optional argument REDRAW is non-nil (which is 1224are run. If the optional argument REDRAW is non-nil (which is
1180the case interactively, for example) then any existing diary 1225the case interactively, for example) then any existing diary
1181marks are first removed. This is intended to deal with deleted 1226marks are first removed. This is intended to deal with deleted
@@ -1190,7 +1235,7 @@ diary entries."
1190 (when (and redraw mark-diary-entries-in-calendar) 1235 (when (and redraw mark-diary-entries-in-calendar)
1191 (setq mark-diary-entries-in-calendar nil) 1236 (setq mark-diary-entries-in-calendar nil)
1192 (redraw-calendar)) 1237 (redraw-calendar))
1193 (let ((marking-diary-entries t) 1238 (let ((diary-marking-entries-flag t)
1194 file-glob-attrs) 1239 file-glob-attrs)
1195 (with-current-buffer (find-file-noselect (diary-check-diary-file) t) 1240 (with-current-buffer (find-file-noselect (diary-check-diary-file) t)
1196 (save-excursion 1241 (save-excursion
@@ -1199,12 +1244,14 @@ diary entries."
1199 (message "Marking diary entries...") 1244 (message "Marking diary entries...")
1200 (setq file-glob-attrs (nth 1 (diary-pull-attrs nil '()))) 1245 (setq file-glob-attrs (nth 1 (diary-pull-attrs nil '())))
1201 (with-syntax-table diary-syntax-table 1246 (with-syntax-table diary-syntax-table
1202 (diary-mark-entries-1 'mark-calendar-date-pattern) 1247 (diary-mark-entries-1 'calendar-mark-date-pattern)
1203 (mark-sexp-diary-entries) 1248 (diary-mark-sexp-entries)
1204 (run-hooks 'nongregorian-diary-marking-hook 1249 (run-hooks 'diary-nongregorian-marking-hook
1205 'mark-diary-entries-hook)) 1250 'diary-mark-entries-hook))
1206 (message "Marking diary entries...done"))))) 1251 (message "Marking diary entries...done")))))
1207 1252
1253;;;###cal-autoload
1254(define-obsolete-function-alias 'mark-diary-entries 'diary-mark-entries "23.1")
1208 1255
1209(defun diary-sexp-entry (sexp entry date) 1256(defun diary-sexp-entry (sexp entry date)
1210 "Process a SEXP diary ENTRY for DATE." 1257 "Process a SEXP diary ENTRY for DATE."
@@ -1228,11 +1275,11 @@ diary entries."
1228(defvar displayed-year) ; bound in generate-calendar 1275(defvar displayed-year) ; bound in generate-calendar
1229(defvar displayed-month) 1276(defvar displayed-month)
1230 1277
1231(defun mark-sexp-diary-entries () 1278(defun diary-mark-sexp-entries ()
1232 "Mark days in the calendar window that have sexp diary entries. 1279 "Mark days in the calendar window that have sexp diary entries.
1233Each entry in the diary file (or included files) visible in the calendar window 1280Each entry in the diary file (or included files) visible in the calendar window
1234is marked. See the documentation for the function `list-sexp-diary-entries'." 1281is marked. See the documentation for the function `diary-list-sexp-entries'."
1235 (let* ((sexp-mark (regexp-quote sexp-diary-entry-symbol)) 1282 (let* ((sexp-mark (regexp-quote diary-sexp-entry-symbol))
1236 (s-entry (format "^\\(%s(\\)\\|\\(%s%s(diary-remind\\)" sexp-mark 1283 (s-entry (format "^\\(%s(\\)\\|\\(%s%s(diary-remind\\)" sexp-mark
1237 (regexp-quote diary-nonmarking-symbol) 1284 (regexp-quote diary-nonmarking-symbol)
1238 sexp-mark)) 1285 sexp-mark))
@@ -1251,7 +1298,7 @@ is marked. See the documentation for the function `list-sexp-diary-entries'."
1251 (list m (calendar-last-day-of-month m y) y))) 1298 (list m (calendar-last-day-of-month m y) y)))
1252 (goto-char (point-min)) 1299 (goto-char (point-min))
1253 (while (re-search-forward s-entry nil t) 1300 (while (re-search-forward s-entry nil t)
1254 (setq marking-diary-entry (char-equal (preceding-char) ?\()) 1301 (setq diary-marking-entry-flag (char-equal (preceding-char) ?\())
1255 (re-search-backward "(") 1302 (re-search-backward "(")
1256 (setq sexp-start (point)) 1303 (setq sexp-start (point))
1257 (forward-sexp) 1304 (forward-sexp)
@@ -1278,9 +1325,12 @@ is marked. See the documentation for the function `list-sexp-diary-entries'."
1278 (or (cadr (diary-pull-attrs entry file-glob-attrs)) 1325 (or (cadr (diary-pull-attrs entry file-glob-attrs))
1279 (if (consp mark) (car mark))))))))) 1326 (if (consp mark) (car mark)))))))))
1280 1327
1281(defun mark-included-diary-files () 1328(define-obsolete-function-alias 'mark-sexp-diary-entries
1329 'diary-mark-sexp-entries "23.1")
1330
1331(defun diary-mark-included-diary-files ()
1282 "Mark the diary entries from other diary files with those of the diary file. 1332 "Mark the diary entries from other diary files with those of the diary file.
1283This function is suitable for use with `mark-diary-entries-hook'; it enables 1333This function is suitable for use with `diary-mark-entries-hook'; it enables
1284you to use shared diary files together with your own. The files included are 1334you to use shared diary files together with your own. The files included are
1285specified in the `diary-file' by lines of this form: 1335specified in the `diary-file' by lines of this form:
1286 #include \"filename\" 1336 #include \"filename\"
@@ -1293,12 +1343,12 @@ changing the variable `diary-include-string'."
1293 nil t) 1343 nil t)
1294 (let* ((diary-file (substitute-in-file-name 1344 (let* ((diary-file (substitute-in-file-name
1295 (match-string-no-properties 1))) 1345 (match-string-no-properties 1)))
1296 (mark-diary-entries-hook 'mark-included-diary-files) 1346 (diary-mark-entries-hook 'diary-mark-included-diary-files)
1297 (dbuff (find-buffer-visiting diary-file))) 1347 (dbuff (find-buffer-visiting diary-file)))
1298 (if (file-exists-p diary-file) 1348 (if (file-exists-p diary-file)
1299 (if (file-readable-p diary-file) 1349 (if (file-readable-p diary-file)
1300 (progn 1350 (progn
1301 (mark-diary-entries) 1351 (diary-mark-entries)
1302 (unless dbuff 1352 (unless dbuff
1303 (kill-buffer (find-buffer-visiting diary-file)))) 1353 (kill-buffer (find-buffer-visiting diary-file))))
1304 (beep) 1354 (beep)
@@ -1309,7 +1359,10 @@ changing the variable `diary-include-string'."
1309 (sleep-for 2)))) 1359 (sleep-for 2))))
1310 (goto-char (point-min))) 1360 (goto-char (point-min)))
1311 1361
1312(defun mark-calendar-days-named (dayname &optional color) 1362(define-obsolete-function-alias 'mark-included-diary-files
1363 'diary-mark-included-diary-files "23.1")
1364
1365(defun calendar-mark-days-named (dayname &optional color)
1313 "Mark all dates in the calendar window that are day DAYNAME of the week. 1366 "Mark all dates in the calendar window that are day DAYNAME of the week.
13140 means all Sundays, 1 means all Mondays, and so on. 13670 means all Sundays, 1 means all Mondays, and so on.
1315Optional argument COLOR is passed to `mark-visible-calendar-date' as MARK." 1368Optional argument COLOR is passed to `mark-visible-calendar-date' as MARK."
@@ -1331,7 +1384,10 @@ Optional argument COLOR is passed to `mark-visible-calendar-date' as MARK."
1331 color) 1384 color)
1332 (setq day (+ day 7)))))) 1385 (setq day (+ day 7))))))
1333 1386
1334(defun mark-calendar-month (month year p-month p-day p-year &optional color) 1387(define-obsolete-function-alias 'mark-calendar-days-named
1388 'calendar-mark-days-named "23.1")
1389
1390(defun calendar-mark-month (month year p-month p-day p-year &optional color)
1335 "Mark dates in the MONTH/YEAR that conform to pattern P-MONTH/P-DAY/P-YEAR. 1391 "Mark dates in the MONTH/YEAR that conform to pattern P-MONTH/P-DAY/P-YEAR.
1336A value of 0 in any position of the pattern is a wildcard. 1392A value of 0 in any position of the pattern is a wildcard.
1337Optional argument COLOR is passed to `mark-visible-calendar-date' as MARK." 1393Optional argument COLOR is passed to `mark-visible-calendar-date' as MARK."
@@ -1344,7 +1400,10 @@ Optional argument COLOR is passed to `mark-visible-calendar-date' as MARK."
1344 (mark-visible-calendar-date (list month (1+ i) year) color)) 1400 (mark-visible-calendar-date (list month (1+ i) year) color))
1345 (mark-visible-calendar-date (list month p-day year) color)))) 1401 (mark-visible-calendar-date (list month p-day year) color))))
1346 1402
1347(defun mark-calendar-date-pattern (month day year &optional color) 1403(define-obsolete-function-alias 'mark-calendar-month
1404 'calendar-mark-month "23.1")
1405
1406(defun calendar-mark-date-pattern (month day year &optional color)
1348 "Mark all dates in the calendar window that conform to MONTH/DAY/YEAR. 1407 "Mark all dates in the calendar window that conform to MONTH/DAY/YEAR.
1349A value of 0 in any position is a wildcard. Optional argument COLOR is 1408A value of 0 in any position is a wildcard. Optional argument COLOR is
1350passed to `mark-visible-calendar-date' as MARK." 1409passed to `mark-visible-calendar-date' as MARK."
@@ -1353,9 +1412,11 @@ passed to `mark-visible-calendar-date' as MARK."
1353 (y displayed-year)) 1412 (y displayed-year))
1354 (increment-calendar-month m y -1) 1413 (increment-calendar-month m y -1)
1355 (dotimes (idummy 3) 1414 (dotimes (idummy 3)
1356 (mark-calendar-month m y month day year color) 1415 (calendar-mark-month m y month day year color)
1357 (increment-calendar-month m y 1))))) 1416 (increment-calendar-month m y 1)))))
1358 1417
1418(define-obsolete-function-alias 'mark-calendar-date-pattern
1419 'calendar-mark-date-pattern "23.1")
1359 1420
1360;; Bahai, Hebrew, Islamic. 1421;; Bahai, Hebrew, Islamic.
1361(defun calendar-mark-complex (month day year fromabs &optional color) 1422(defun calendar-mark-complex (month day year fromabs &optional color)
@@ -1457,16 +1518,18 @@ be used instead of a colon (:) to separate the hour and minute parts."
1457 (and (= t1 t2) 1518 (and (= t1 t2)
1458 (string-lessp ts1 ts2))))))) 1519 (string-lessp ts1 ts2)))))))
1459 1520
1460(defun sort-diary-entries () 1521(defun diary-sort-entries ()
1461 "Sort the list of diary entries by time of day." 1522 "Sort the list of diary entries by time of day."
1462 (setq diary-entries-list (sort diary-entries-list 'diary-entry-compare))) 1523 (setq diary-entries-list (sort diary-entries-list 'diary-entry-compare)))
1463 1524
1525(define-obsolete-function-alias 'sort-diary-entries 'diary-sort-entries "23.1")
1526
1464 1527
1465(defun list-sexp-diary-entries (date) 1528(defun diary-list-sexp-entries (date)
1466 "Add sexp entries for DATE from the diary file to `diary-entries-list'. 1529 "Add sexp entries for DATE from the diary file to `diary-entries-list'.
1467Also, make them visible in the diary. Returns t if any entries are found. 1530Also, make them visible in the diary. Returns t if any entries are found.
1468 1531
1469Sexp diary entries must be prefaced by a `sexp-diary-entry-symbol' 1532Sexp diary entries must be prefaced by a `diary-sexp-entry-symbol'
1470\(normally `%%'). The form of a sexp diary entry is 1533\(normally `%%'). The form of a sexp diary entry is
1471 1534
1472 %%(SEXP) ENTRY 1535 %%(SEXP) ENTRY
@@ -1547,7 +1610,7 @@ DAY MONTH YEAR in the European style).
1547 before. 1610 before.
1548 1611
1549All the remaining functions do not accept any text, and so only 1612All the remaining functions do not accept any text, and so only
1550make sense with `fancy-diary-display'. Most produce output every day. 1613make sense with `diary-fancy-display'. Most produce output every day.
1551 1614
1552`diary-day-of-year' - day of year and number of days remaining 1615`diary-day-of-year' - day of year and number of days remaining
1553`diary-iso-date' - ISO commercial date 1616`diary-iso-date' - ISO commercial date
@@ -1573,7 +1636,7 @@ Theses functions only produce output on certain dates:
1573Marking these entries is *extremely* time consuming, so it is 1636Marking these entries is *extremely* time consuming, so it is
1574best if they are non-marking." 1637best if they are non-marking."
1575 (let ((s-entry (format "^%s?%s(" (regexp-quote diary-nonmarking-symbol) 1638 (let ((s-entry (format "^%s?%s(" (regexp-quote diary-nonmarking-symbol)
1576 (regexp-quote sexp-diary-entry-symbol))) 1639 (regexp-quote diary-sexp-entry-symbol)))
1577 entry-found file-glob-attrs marks 1640 entry-found file-glob-attrs marks
1578 sexp-start sexp entry specifier entry-start line-start 1641 sexp-start sexp entry specifier entry-start line-start
1579 diary-entry temp literal) 1642 diary-entry temp literal)
@@ -1612,12 +1675,14 @@ best if they are non-marking."
1612 (setq temp (diary-pull-attrs entry file-glob-attrs) 1675 (setq temp (diary-pull-attrs entry file-glob-attrs)
1613 entry (nth 0 temp) 1676 entry (nth 0 temp)
1614 marks (nth 1 temp)))) 1677 marks (nth 1 temp))))
1615 (add-to-diary-list date entry specifier 1678 (diary-add-to-list date entry specifier
1616 (if entry-start (copy-marker entry-start)) 1679 (if entry-start (copy-marker entry-start))
1617 marks literal) 1680 marks literal)
1618 (setq entry-found (or entry-found diary-entry))) 1681 (setq entry-found (or entry-found diary-entry)))
1619 entry-found)) 1682 entry-found))
1620 1683
1684(define-obsolete-function-alias 'list-sexp-diary-entries
1685 'diary-list-sexp-entries "23.1")
1621 1686
1622(defun diary-make-date (a b c) 1687(defun diary-make-date (a b c)
1623 "Convert A B C into the internal calendar date form. 1688 "Convert A B C into the internal calendar date form.
@@ -1827,12 +1892,12 @@ marked on the calendar."
1827 (cond 1892 (cond
1828 ;; Diary entry applies on date. 1893 ;; Diary entry applies on date.
1829 ((and diary-entry 1894 ((and diary-entry
1830 (or (not marking-diary-entries) marking-diary-entry)) 1895 (or (not diary-marking-entries-flag) diary-marking-entry-flag))
1831 diary-entry) 1896 diary-entry)
1832 ;; Diary entry may apply to `days' before date. 1897 ;; Diary entry may apply to `days' before date.
1833 ((and (integerp days) 1898 ((and (integerp days)
1834 (not diary-entry) ; diary entry does not apply to date 1899 (not diary-entry) ; diary entry does not apply to date
1835 (or (not marking-diary-entries) marking)) 1900 (or (not diary-marking-entries-flag) marking))
1836 (setq date (calendar-gregorian-from-absolute 1901 (setq date (calendar-gregorian-from-absolute
1837 (+ (calendar-absolute-from-gregorian date) days))) 1902 (+ (calendar-absolute-from-gregorian date) days)))
1838 (when (setq diary-entry (eval sexp)) ; re-evaluate with adjusted date 1903 (when (setq diary-entry (eval sexp)) ; re-evaluate with adjusted date
@@ -1848,7 +1913,7 @@ marked on the calendar."
1848;;; Diary insertion functions. 1913;;; Diary insertion functions.
1849 1914
1850;;;###cal-autoload 1915;;;###cal-autoload
1851(defun make-diary-entry (string &optional nonmarking file) 1916(defun diary-make-entry (string &optional nonmarking file)
1852 "Insert a diary entry STRING which may be NONMARKING in FILE. 1917 "Insert a diary entry STRING which may be NONMARKING in FILE.
1853If omitted, NONMARKING defaults to nil and FILE defaults to 1918If omitted, NONMARKING defaults to nil and FILE defaults to
1854`diary-file'." 1919`diary-file'."
@@ -1872,21 +1937,31 @@ If omitted, NONMARKING defaults to nil and FILE defaults to
1872 string " ")) 1937 string " "))
1873 1938
1874;;;###cal-autoload 1939;;;###cal-autoload
1875(defun insert-diary-entry (arg) 1940(define-obsolete-function-alias 'make-diary-entry 'diary-make-entry "23.1")
1941
1942;;;###cal-autoload
1943(defun diary-insert-entry (arg)
1876 "Insert a diary entry for the date indicated by point. 1944 "Insert a diary entry for the date indicated by point.
1877Prefix argument ARG makes the entry nonmarking." 1945Prefix argument ARG makes the entry nonmarking."
1878 (interactive "P") 1946 (interactive "P")
1879 (make-diary-entry (calendar-date-string (calendar-cursor-to-date t) t t) 1947 (diary-make-entry (calendar-date-string (calendar-cursor-to-date t) t t)
1880 arg)) 1948 arg))
1881 1949
1882;;;###cal-autoload 1950;;;###cal-autoload
1883(defun insert-weekly-diary-entry (arg) 1951(define-obsolete-function-alias 'insert-diary-entry 'diary-insert-entry "23.1")
1952
1953;;;###cal-autoload
1954(defun diary-insert-weekly-entry (arg)
1884 "Insert a weekly diary entry for the day of the week indicated by point. 1955 "Insert a weekly diary entry for the day of the week indicated by point.
1885Prefix argument ARG makes the entry nonmarking." 1956Prefix argument ARG makes the entry nonmarking."
1886 (interactive "P") 1957 (interactive "P")
1887 (make-diary-entry (calendar-day-name (calendar-cursor-to-date t)) 1958 (diary-make-entry (calendar-day-name (calendar-cursor-to-date t))
1888 arg)) 1959 arg))
1889 1960
1961;;;###cal-autoload
1962(define-obsolete-function-alias 'insert-weekly-diary-entry
1963 'diary-insert-weekly-entry "23.1")
1964
1890(defun diary-date-display-form (&optional type) 1965(defun diary-date-display-form (&optional type)
1891 "Return value for `calendar-date-display-form' using `calendar-date-style.' 1966 "Return value for `calendar-date-display-form' using `calendar-date-style.'
1892Optional symbol TYPE is either `monthly' or `yearly'." 1967Optional symbol TYPE is either `monthly' or `yearly'."
@@ -1924,7 +1999,7 @@ dates of the appropriate type."
1924 calendar-date-display-form)) 1999 calendar-date-display-form))
1925 (calendar-month-name-array (or months calendar-month-name-array)) 2000 (calendar-month-name-array (or months calendar-month-name-array))
1926 (date (calendar-cursor-to-date t))) 2001 (date (calendar-cursor-to-date t)))
1927 (make-diary-entry 2002 (diary-make-entry
1928 (format "%s%s" (or symbol "") 2003 (format "%s%s" (or symbol "")
1929 (calendar-date-string 2004 (calendar-date-string
1930 (if absfunc 2005 (if absfunc
@@ -1935,33 +2010,45 @@ dates of the appropriate type."
1935 nomark))) 2010 nomark)))
1936 2011
1937;;;###cal-autoload 2012;;;###cal-autoload
1938(defun insert-monthly-diary-entry (arg) 2013(defun diary-insert-monthly-entry (arg)
1939 "Insert a monthly diary entry for the day of the month indicated by point. 2014 "Insert a monthly diary entry for the day of the month indicated by point.
1940Prefix argument ARG makes the entry nonmarking." 2015Prefix argument ARG makes the entry nonmarking."
1941 (interactive "P") 2016 (interactive "P")
1942 (diary-insert-entry-1 'monthly arg)) 2017 (diary-insert-entry-1 'monthly arg))
1943 2018
1944;;;###cal-autoload 2019;;;###cal-autoload
1945(defun insert-yearly-diary-entry (arg) 2020(define-obsolete-function-alias 'insert-monthly-diary-entry
2021 'diary-insert-monthly-entry "23.1")
2022
2023;;;###cal-autoload
2024(defun diary-insert-yearly-entry (arg)
1946 "Insert an annual diary entry for the day of the year indicated by point. 2025 "Insert an annual diary entry for the day of the year indicated by point.
1947Prefix argument ARG makes the entry nonmarking." 2026Prefix argument ARG makes the entry nonmarking."
1948 (interactive "P") 2027 (interactive "P")
1949 (diary-insert-entry-1 'yearly arg)) 2028 (diary-insert-entry-1 'yearly arg))
1950 2029
1951;;;###cal-autoload 2030;;;###cal-autoload
1952(defun insert-anniversary-diary-entry (arg) 2031(define-obsolete-function-alias 'insert-yearly-diary-entry
2032 'diary-insert-yearly-entry "23.1")
2033
2034;;;###cal-autoload
2035(defun diary-insert-anniversary-entry (arg)
1953 "Insert an anniversary diary entry for the date given by point. 2036 "Insert an anniversary diary entry for the date given by point.
1954Prefix argument ARG makes the entry nonmarking." 2037Prefix argument ARG makes the entry nonmarking."
1955 (interactive "P") 2038 (interactive "P")
1956 (let ((calendar-date-display-form (diary-date-display-form))) 2039 (let ((calendar-date-display-form (diary-date-display-form)))
1957 (make-diary-entry 2040 (diary-make-entry
1958 (format "%s(diary-anniversary %s)" 2041 (format "%s(diary-anniversary %s)"
1959 sexp-diary-entry-symbol 2042 diary-sexp-entry-symbol
1960 (calendar-date-string (calendar-cursor-to-date t) nil t)) 2043 (calendar-date-string (calendar-cursor-to-date t) nil t))
1961 arg))) 2044 arg)))
1962 2045
1963;;;###cal-autoload 2046;;;###cal-autoload
1964(defun insert-block-diary-entry (arg) 2047(define-obsolete-function-alias 'insert-anniversary-diary-entry
2048 'diary-insert-anniversary-entry "23.1")
2049
2050;;;###cal-autoload
2051(defun diary-insert-block-entry (arg)
1965 "Insert a block diary entry for the days between the point and marked date. 2052 "Insert a block diary entry for the days between the point and marked date.
1966Prefix argument ARG makes the entry nonmarking." 2053Prefix argument ARG makes the entry nonmarking."
1967 (interactive "P") 2054 (interactive "P")
@@ -1976,27 +2063,35 @@ Prefix argument ARG makes the entry nonmarking."
1976 end cursor) 2063 end cursor)
1977 (setq start cursor 2064 (setq start cursor
1978 end mark)) 2065 end mark))
1979 (make-diary-entry 2066 (diary-make-entry
1980 (format "%s(diary-block %s %s)" 2067 (format "%s(diary-block %s %s)"
1981 sexp-diary-entry-symbol 2068 diary-sexp-entry-symbol
1982 (calendar-date-string start nil t) 2069 (calendar-date-string start nil t)
1983 (calendar-date-string end nil t)) 2070 (calendar-date-string end nil t))
1984 arg))) 2071 arg)))
1985 2072
1986;;;###cal-autoload 2073;;;###cal-autoload
1987(defun insert-cyclic-diary-entry (arg) 2074(define-obsolete-function-alias 'insert-block-diary-entry
2075 'diary-insert-block-entry "23.1")
2076
2077;;;###cal-autoload
2078(defun diary-insert-cyclic-entry (arg)
1988 "Insert a cyclic diary entry starting at the date given by point. 2079 "Insert a cyclic diary entry starting at the date given by point.
1989Prefix argument ARG makes the entry nonmarking." 2080Prefix argument ARG makes the entry nonmarking."
1990 (interactive "P") 2081 (interactive "P")
1991 (let ((calendar-date-display-form (diary-date-display-form))) 2082 (let ((calendar-date-display-form (diary-date-display-form)))
1992 (make-diary-entry 2083 (diary-make-entry
1993 (format "%s(diary-cyclic %d %s)" 2084 (format "%s(diary-cyclic %d %s)"
1994 sexp-diary-entry-symbol 2085 diary-sexp-entry-symbol
1995 (calendar-read "Repeat every how many days: " 2086 (calendar-read "Repeat every how many days: "
1996 (lambda (x) (> x 0))) 2087 (lambda (x) (> x 0)))
1997 (calendar-date-string (calendar-cursor-to-date t) nil t)) 2088 (calendar-date-string (calendar-cursor-to-date t) nil t))
1998 arg))) 2089 arg)))
1999 2090
2091;;;###cal-autoload
2092(define-obsolete-function-alias 'insert-cyclic-diary-entry
2093 'diary-insert-cyclic-entry "23.1")
2094
2000;;; Diary mode. 2095;;; Diary mode.
2001 2096
2002(defun diary-redraw-calendar () 2097(defun diary-redraw-calendar ()
@@ -2018,7 +2113,7 @@ Prefix argument ARG makes the entry nonmarking."
2018 "Recognize sexp diary entry up to LIMIT for font-locking." 2113 "Recognize sexp diary entry up to LIMIT for font-locking."
2019 (if (re-search-forward 2114 (if (re-search-forward
2020 (format "^%s?\\(%s\\)" (regexp-quote diary-nonmarking-symbol) 2115 (format "^%s?\\(%s\\)" (regexp-quote diary-nonmarking-symbol)
2021 (regexp-quote sexp-diary-entry-symbol)) 2116 (regexp-quote diary-sexp-entry-symbol))
2022 limit t) 2117 limit t)
2023 (condition-case nil 2118 (condition-case nil
2024 (save-restriction 2119 (save-restriction
@@ -2063,11 +2158,11 @@ names."
2063 2158
2064(defmacro diary-font-lock-keywords-1 (markfunc listfunc feature months symbol) 2159(defmacro diary-font-lock-keywords-1 (markfunc listfunc feature months symbol)
2065 "Subroutine of the function `diary-font-lock-keywords'. 2160 "Subroutine of the function `diary-font-lock-keywords'.
2066If MARKFUNC is a member of `nongregorian-diary-marking-hook', or 2161If MARKFUNC is a member of `diary-nongregorian-marking-hook', or
2067LISTFUNC of `nongregorian-diary-listing-hook', then require FEATURE 2162LISTFUNC of `diary-nongregorian-listing-hook', then require FEATURE
2068and return a font-lock pattern matching array of MONTHS and marking SYMBOL." 2163and return a font-lock pattern matching array of MONTHS and marking SYMBOL."
2069 `(when (or (memq ',markfunc nongregorian-diary-marking-hook) 2164 `(when (or (memq ',markfunc diary-nongregorian-marking-hook)
2070 (memq ',listfunc nongregorian-diary-listing-hook)) 2165 (memq ',listfunc diary-nongregorian-listing-hook))
2071 (require ',feature) 2166 (require ',feature)
2072 (diary-font-lock-date-forms ,months ,symbol))) 2167 (diary-font-lock-date-forms ,months ,symbol)))
2073 2168
@@ -2111,7 +2206,7 @@ and return a font-lock pattern matching array of MONTHS and marking SYMBOL."
2111 'font-lock-keyword-face) 2206 'font-lock-keyword-face)
2112 (cons 2207 (cons
2113 (format "^%s?\\(%s\\)" (regexp-quote diary-nonmarking-symbol) 2208 (format "^%s?\\(%s\\)" (regexp-quote diary-nonmarking-symbol)
2114 (regexp-quote sexp-diary-entry-symbol)) 2209 (regexp-quote diary-sexp-entry-symbol))
2115 '(1 font-lock-reference-face)) 2210 '(1 font-lock-reference-face))
2116 (cons 2211 (cons
2117 (format "^%s" (regexp-quote diary-nonmarking-symbol)) 2212 (format "^%s" (regexp-quote diary-nonmarking-symbol))
@@ -2157,7 +2252,7 @@ and return a font-lock pattern matching array of MONTHS and marking SYMBOL."
2157 "\\(: .*\\)?") 2252 "\\(: .*\\)?")
2158 "Regular expression matching a date header in Fancy Diary.") 2253 "Regular expression matching a date header in Fancy Diary.")
2159 2254
2160(defvar fancy-diary-font-lock-keywords 2255(defvar diary-fancy-font-lock-keywords
2161 (list 2256 (list
2162 (list 2257 (list
2163 ;; Any number of " other holiday name" lines, followed by "==" line. 2258 ;; Any number of " other holiday name" lines, followed by "==" line.
@@ -2174,11 +2269,14 @@ and return a font-lock pattern matching array of MONTHS and marking SYMBOL."
2174 diary-time-regexp) . 'diary-time)) 2269 diary-time-regexp) . 'diary-time))
2175 "Keywords to highlight in fancy diary display.") 2270 "Keywords to highlight in fancy diary display.")
2176 2271
2272(define-obsolete-variable-alias 'fancy-diary-font-lock-keywords
2273 'diary-fancy-font-lock-keywords "23.1")
2274
2177;; If region looks like it might start or end in the middle of a 2275;; If region looks like it might start or end in the middle of a
2178;; multiline pattern, extend the region to encompass the whole pattern. 2276;; multiline pattern, extend the region to encompass the whole pattern.
2179(defun diary-fancy-font-lock-fontify-region-function (beg end &optional verbose) 2277(defun diary-fancy-font-lock-fontify-region-function (beg end &optional verbose)
2180 "Function to use for `font-lock-fontify-region-function' in Fancy Diary. 2278 "Function to use for `font-lock-fontify-region-function' in Fancy Diary.
2181Needed to handle multiline keyword in `fancy-diary-font-lock-keywords'. 2279Needed to handle multiline keyword in `diary-fancy-font-lock-keywords'.
2182Fontify the region between BEG and END, quietly unless VERBOSE is non-nil." 2280Fontify the region between BEG and END, quietly unless VERBOSE is non-nil."
2183 (goto-char beg) 2281 (goto-char beg)
2184 (forward-line 0) 2282 (forward-line 0)
@@ -2196,16 +2294,18 @@ Fontify the region between BEG and END, quietly unless VERBOSE is non-nil."
2196 (setq end (line-beginning-position 2))) 2294 (setq end (line-beginning-position 2)))
2197 (font-lock-default-fontify-region beg end verbose)) 2295 (font-lock-default-fontify-region beg end verbose))
2198 2296
2199(define-derived-mode fancy-diary-display-mode fundamental-mode 2297(define-derived-mode diary-fancy-display-mode fundamental-mode
2200 "Diary" 2298 "Diary"
2201 "Major mode used while displaying diary entries using Fancy Display." 2299 "Major mode used while displaying diary entries using Fancy Display."
2202 (set (make-local-variable 'font-lock-defaults) 2300 (set (make-local-variable 'font-lock-defaults)
2203 '(fancy-diary-font-lock-keywords 2301 '(diary-fancy-font-lock-keywords
2204 t nil nil nil 2302 t nil nil nil
2205 (font-lock-fontify-region-function 2303 (font-lock-fontify-region-function
2206 . diary-fancy-font-lock-fontify-region-function))) 2304 . diary-fancy-font-lock-fontify-region-function)))
2207 (local-set-key "q" 'quit-window)) 2305 (local-set-key "q" 'quit-window))
2208 2306
2307(define-obsolete-function-alias 'fancy-diary-display-mode
2308 'diary-fancy-display-mode "23.1")
2209 2309
2210;; Following code from Dave Love <fx@gnu.org>. 2310;; Following code from Dave Love <fx@gnu.org>.
2211;; Import Outlook-format appointments from mail messages in Gnus or 2311;; Import Outlook-format appointments from mail messages in Gnus or
@@ -2236,7 +2336,7 @@ message contains an appointment, don't make a diary entry."
2236 ;; Fixme: References to optional fields in the format 2336 ;; Fixme: References to optional fields in the format
2237 ;; are treated literally, not replaced by the empty 2337 ;; are treated literally, not replaced by the empty
2238 ;; string. I think this is an Emacs bug. 2338 ;; string. I think this is an Emacs bug.
2239 (make-diary-entry 2339 (diary-make-entry
2240 (format (replace-match (if (functionp format-string) 2340 (format (replace-match (if (functionp format-string)
2241 (funcall format-string body) 2341 (funcall format-string body)
2242 format-string) 2342 format-string)