Mercurial > emacs
comparison lisp/calendar/diary-lib.el @ 92973:122f4beea537
(diary-face-attrs, diary-glob-file-regexp-prefix, diary-selective-display)
(number-of-diary-entries, diary-list-entries, diary-goto-entry):
(list-sexp-diary-entries, diary-date, diary-block, diary-float)
(diary-anniversary, diary-cyclic)
(diary-fancy-font-lock-fontify-region-function): Doc fixes.
(diary-header-line-format): Change wording.
(diary-list-entries): Set `date-start' in let.
(include-other-diary-files, mark-included-diary-files): Use format.
(simple-diary-display, fancy-diary-display): Use cadr, unless.
(mark-diary-entries): Use 1+.
(mark-sexp-diary-entries, list-sexp-diary-entries): Use when.
(mark-calendar-month): Use dotimes.
(diary-list-entries-1, diary-mark-entries-1): New functions.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 15 Mar 2008 03:02:16 +0000 |
parents | 3aa36f5712f6 |
children | deb2f6126df1 |
comparison
equal
deleted
inserted
replaced
92972:81a28241fa57 | 92973:122f4beea537 |
---|---|
82 ) | 82 ) |
83 "Alist of (REGEXP SUBEXP ATTRIBUTE TYPE) elements. | 83 "Alist of (REGEXP SUBEXP ATTRIBUTE TYPE) elements. |
84 This is used by `diary-pull-attrs' to fontify certain diary | 84 This is used by `diary-pull-attrs' to fontify certain diary |
85 elements. REGEXP is a regular expression to for, and SUBEXP is | 85 elements. REGEXP is a regular expression to for, and SUBEXP is |
86 the numbered sub-expression to extract. `diary-glob-file-regexp-prefix' | 86 the numbered sub-expression to extract. `diary-glob-file-regexp-prefix' |
87 is prepended to REGEXP for file-wide specifiers. ATTRIBUTE | 87 is pre-pended to REGEXP for file-wide specifiers. ATTRIBUTE |
88 specifies which face attribute (e.g. `:foreground') to modify, or | 88 specifies which face attribute (e.g. `:foreground') to modify, or |
89 that this is a face (`:face') to apply. TYPE is the type of | 89 that this is a face (`:face') to apply. TYPE is the type of |
90 attribute being applied. Available TYPES (see `diary-attrtype-convert') | 90 attribute being applied. Available TYPES (see `diary-attrtype-convert') |
91 are: `string', `symbol', `int', `tnil',`stringtnil.'" | 91 are: `string', `symbol', `int', `tnil',`stringtnil.'" |
92 :type '(repeat (list (string :tag "Regular expression") | 92 :type '(repeat (list (string :tag "Regular expression") |
99 (const stringtnil | 99 (const stringtnil |
100 :tag "A string, `t', or `nil'")))) | 100 :tag "A string, `t', or `nil'")))) |
101 :group 'diary) | 101 :group 'diary) |
102 | 102 |
103 (defcustom diary-glob-file-regexp-prefix "^\\#" | 103 (defcustom diary-glob-file-regexp-prefix "^\\#" |
104 "Regular expression prepended to `diary-face-attrs' for file-wide specifiers." | 104 "Regular expression pre-pended to `diary-face-attrs' for file-wide specifiers." |
105 :type 'regexp | 105 :type 'regexp |
106 :group 'diary) | 106 :group 'diary) |
107 | 107 |
108 (defcustom diary-file-name-prefix nil | 108 (defcustom diary-file-name-prefix nil |
109 "Non-nil means prefix each diary entry with the name of the file defining it." | 109 "Non-nil means prefix each diary entry with the name of the file defining it." |
415 :initialize 'custom-initialize-default | 415 :initialize 'custom-initialize-default |
416 ;; FIXME overkill. | 416 ;; FIXME overkill. |
417 :set 'diary-set-maybe-redraw | 417 :set 'diary-set-maybe-redraw |
418 :version "22.1") | 418 :version "22.1") |
419 | 419 |
420 (defvar diary-selective-display nil) | 420 (defvar diary-selective-display nil |
421 "Internal diary variable; non-nil if some diary text is hidden.") | |
421 | 422 |
422 (defcustom diary-header-line-format | 423 (defcustom diary-header-line-format |
423 '(:eval (calendar-string-spread | 424 '(:eval (calendar-string-spread |
424 (list (if diary-selective-display | 425 (list (if diary-selective-display |
425 "Selective display active - press \"s\" in calendar \ | 426 "Some text is hidden - press \"s\" in calendar \ |
426 before edit/copy" | 427 before edit/copy" |
427 "Diary")) | 428 "Diary")) |
428 ?\s (frame-width))) | 429 ?\s (frame-width))) |
429 "Format of the header line displayed by `simple-diary-display'. | 430 "Format of the header line displayed by `simple-diary-display'. |
430 Only used if `diary-header-line-flag' is non-nil." | 431 Only used if `diary-header-line-flag' is non-nil." |
437 | 438 |
438 ;; The first version of this also checked for diary-selective-display | 439 ;; The first version of this also checked for diary-selective-display |
439 ;; in the non-fancy case. This was an attempt to distinguish between | 440 ;; in the non-fancy case. This was an attempt to distinguish between |
440 ;; displaying the diary and just visiting the diary file. However, | 441 ;; displaying the diary and just visiting the diary file. However, |
441 ;; when using fancy diary, calling diary when there are no entries to | 442 ;; when using fancy diary, calling diary when there are no entries to |
442 ;; display does not create the fancy buffer, nor does it switch on | 443 ;; display does not create the fancy buffer, nor does it set |
443 ;; selective-display in the diary buffer. This means some | 444 ;; diary-selective-display in the diary buffer. This means some |
444 ;; customizations will not take effect, eg: | 445 ;; customizations will not take effect, eg: |
445 ;; http://lists.gnu.org/archive/html/emacs-pretest-bug/2007-03/msg00466.html | 446 ;; http://lists.gnu.org/archive/html/emacs-pretest-bug/2007-03/msg00466.html |
446 ;; So the check for selective-display was dropped. This means the | 447 ;; So the check for diary-selective-display was dropped. This means the |
447 ;; diary will be displayed if one customizes a diary variable while | 448 ;; diary will be displayed if one customizes a diary variable while |
448 ;; just visiting the diary-file. This is i) unlikely, and ii) no great loss. | 449 ;; just visiting the diary-file. This is i) unlikely, and ii) no great loss. |
449 ;;;###cal-autoload | 450 ;;;###cal-autoload |
450 (defun diary-live-p () | 451 (defun diary-live-p () |
451 "Return non-nil if the diary is being displayed." | 452 "Return non-nil if the diary is being displayed." |
454 (find-buffer-visiting (substitute-in-file-name diary-file))))) | 455 (find-buffer-visiting (substitute-in-file-name diary-file))))) |
455 | 456 |
456 (defcustom number-of-diary-entries 1 | 457 (defcustom number-of-diary-entries 1 |
457 "Specifies how many days of diary entries are to be displayed initially. | 458 "Specifies how many days of diary entries are to be displayed initially. |
458 This variable affects the diary display when the command \\[diary] is used, | 459 This variable affects the diary display when the command \\[diary] is used, |
459 or if the value of the variable `view-diary-entries-initially' is t. For | 460 or if the value of the variable `view-diary-entries-initially' is non-nil. |
460 example, if the default value 1 is used, then only the current day's diary | 461 For example, if the default value 1 is used, then only the current day's diary |
461 entries will be displayed. If the value 2 is used, then both the current | 462 entries will be displayed. If the value 2 is used, then both the current |
462 day's and the next day's entries will be displayed. | 463 day's and the next day's entries will be displayed. |
463 | 464 |
464 The value can also be a vector such as [0 2 2 2 2 4 1]; this value | 465 The value can also be a vector such as [0 2 2 2 2 4 1]; this value |
465 says to display no diary entries on Sunday, the entries for | 466 says to display no diary entries on Sunday, the entries for |
519 (append diary-entries-list | 520 (append diary-entries-list |
520 (list (list date string specifier | 521 (list (list date string specifier |
521 (list marker (buffer-file-name) literal) | 522 (list marker (buffer-file-name) literal) |
522 globcolor)))))) | 523 globcolor)))))) |
523 | 524 |
525 (defvar number) | |
526 (defvar original-date) | |
527 | |
528 ;; FIXME use for list-diary-entries. | |
529 (defun diary-list-entries-1 (months symbol absfunc) | |
530 "List diary entries of a certain type. | |
531 MONTHS is an array of month names. SYMBOL marks diary entries of the type | |
532 in question. ABSFUNC is a function that converts absolute dates to dates | |
533 of the appropriate type." | |
534 (if (< 0 number) | |
535 (let ((gdate original-date) | |
536 (mark (regexp-quote diary-nonmarking-symbol))) | |
537 (dotimes (idummy number) | |
538 (let* ((tdate (funcall absfunc | |
539 (calendar-absolute-from-gregorian gdate))) | |
540 (month (extract-calendar-month tdate)) | |
541 (day (extract-calendar-day tdate)) | |
542 (year (extract-calendar-year tdate)) | |
543 backup) | |
544 (dolist (date-form diary-date-forms) | |
545 (if (setq backup (eq (car date-form) 'backup)) | |
546 (setq date-form (cdr date-form))) | |
547 (let* ((dayname | |
548 (format "%s\\|%s\\.?" | |
549 (calendar-day-name gdate) | |
550 (calendar-day-name gdate 'abbrev))) | |
551 (calendar-month-name-array months) | |
552 (monthname | |
553 (format "\\*\\|%s" (calendar-month-name month))) | |
554 (month (format "\\*\\|0*%s" (int-to-string month))) | |
555 (day (format "\\*\\|0*%s" (int-to-string day))) | |
556 (year | |
557 (format "\\*\\|0*%s%s" (int-to-string year) | |
558 (if abbreviated-calendar-year | |
559 (format "\\|%s" | |
560 (int-to-string (% year 100))) | |
561 ""))) | |
562 (regexp | |
563 (format "^%s?%s\\(%s\\)" mark (regexp-quote symbol) | |
564 (mapconcat 'eval date-form "\\)\\("))) | |
565 (case-fold-search t)) | |
566 (goto-char (point-min)) | |
567 (while (re-search-forward regexp nil t) | |
568 (if backup (re-search-backward "\\<" nil t)) | |
569 (if (and (bolp) (not (looking-at "[ \t]"))) | |
570 ;; Diary entry that consists only of date. | |
571 (backward-char 1) | |
572 ;; Found a nonempty diary entry--make it visible and | |
573 ;; add it to the list. | |
574 ;; Actual entry starts on the next-line? | |
575 (if (looking-at "[ \t]*\n[ \t]") (forward-line 1)) | |
576 (let ((entry-start (point)) | |
577 ;; If bolp, must have done (forward-line 1). | |
578 (date-start (line-end-position (if (bolp) -1 0)))) | |
579 (forward-line 1) | |
580 (while (looking-at "[ \t]") ; continued entry | |
581 (forward-line 1)) | |
582 (unless (and (eobp) (not (bolp))) | |
583 (backward-char 1)) | |
584 (remove-overlays date-start (point) 'invisible 'diary) | |
585 (add-to-diary-list | |
586 gdate | |
587 (buffer-substring-no-properties entry-start (point)) | |
588 (buffer-substring-no-properties | |
589 (1+ date-start) (1- entry-start)) | |
590 (copy-marker entry-start)))))))) | |
591 (setq gdate | |
592 (calendar-gregorian-from-absolute | |
593 (1+ (calendar-absolute-from-gregorian gdate)))))) | |
594 (goto-char (point-min)))) | |
595 | |
524 (define-obsolete-function-alias 'list-diary-entries 'diary-list-entries) | 596 (define-obsolete-function-alias 'list-diary-entries 'diary-list-entries) |
525 (defun diary-list-entries (date number &optional list-only) | 597 (defun diary-list-entries (date number &optional list-only) |
526 "Create and display a buffer containing the relevant lines in `diary-file'. | 598 "Create and display a buffer containing the relevant lines in `diary-file'. |
527 The arguments are DATE and NUMBER; the entries selected are those | 599 The arguments are DATE and NUMBER; the entries selected are those |
528 for NUMBER days starting with date DATE. The other entries are hidden | 600 for NUMBER days starting with date DATE. The other entries are hidden |
529 using selective display. If NUMBER is less than 1, this function does nothing. | 601 using overlays. If NUMBER is less than 1, this function does nothing. |
530 | 602 |
531 Returns a list of all relevant diary entries found, if any, in order by date. | 603 Returns a list of all relevant diary entries found, if any, in order by date. |
532 The list entries have the form ((MONTH DAY YEAR) STRING SPECIFIER) where | 604 The list entries have the form ((MONTH DAY YEAR) STRING SPECIFIER) where |
533 \(MONTH DAY YEAR) is the date of the entry, STRING is the entry text, and | 605 \(MONTH DAY YEAR) is the date of the entry, STRING is the entry text, and |
534 SPECIFIER is the applicability. If the variable `diary-list-include-blanks' | 606 SPECIFIER is the applicability. If the variable `diary-list-include-blanks' |
535 is t, this list includes a dummy diary entry consisting of the empty string | 607 is non-nil, this list includes a dummy diary entry consisting of the empty |
536 for a date with no diary entries. | 608 string for a date with no diary entries. |
537 | 609 |
538 After the list is prepared, the hooks `nongregorian-diary-listing-hook', | 610 After the list is prepared, the hooks `nongregorian-diary-listing-hook', |
539 `list-diary-entries-hook', `diary-display-hook', and `diary-hook' are run. | 611 `list-diary-entries-hook', `diary-display-hook', and `diary-hook' are run. |
540 These hooks have the following distinct roles: | 612 These hooks have the following distinct roles: |
541 | 613 |
646 ;; Found a nonempty diary entry--make it | 718 ;; Found a nonempty diary entry--make it |
647 ;; visible and add it to the list. | 719 ;; visible and add it to the list. |
648 (setq entry-found t) | 720 (setq entry-found t) |
649 (if (looking-at "[ \t]*\n[ \t]") (forward-line 1)) | 721 (if (looking-at "[ \t]*\n[ \t]") (forward-line 1)) |
650 (let ((entry-start (point)) | 722 (let ((entry-start (point)) |
651 date-start temp) | 723 (temp) |
652 (setq date-start | 724 (date-start |
653 (line-end-position | 725 (line-end-position |
654 (if (and (bolp) (> number 1)) -1 0))) | 726 ;; FIXME Why number > 1? |
727 (if (and (bolp) (> number 1)) -1 0)))) | |
655 (forward-line 1) | 728 (forward-line 1) |
656 (while (looking-at "[ \t]") | 729 (while (looking-at "[ \t]") |
657 (forward-line 1)) | 730 (forward-line 1)) |
658 (unless (and (eobp) (not (bolp))) | 731 (unless (and (eobp) (not (bolp))) |
659 (backward-char 1)) | 732 (backward-char 1)) |
704 This is recursive; that is, #include directives in diary files thus included | 777 This is recursive; that is, #include directives in diary files thus included |
705 are obeyed. You can change the `#include' to some other string by | 778 are obeyed. You can change the `#include' to some other string by |
706 changing the variable `diary-include-string'." | 779 changing the variable `diary-include-string'." |
707 (goto-char (point-min)) | 780 (goto-char (point-min)) |
708 (while (re-search-forward | 781 (while (re-search-forward |
709 (concat | 782 (format "^%s \"\\([^\"]*\\)\"" (regexp-quote diary-include-string)) |
710 "^" | |
711 (regexp-quote diary-include-string) | |
712 " \"\\([^\"]*\\)\"") | |
713 nil t) | 783 nil t) |
714 (let ((diary-file (substitute-in-file-name | 784 (let ((diary-file (substitute-in-file-name |
715 (match-string-no-properties 1))) | 785 (match-string-no-properties 1))) |
716 (diary-list-include-blanks nil) | 786 (diary-list-include-blanks nil) |
717 (list-diary-entries-hook 'include-other-diary-files) | 787 (list-diary-entries-hook 'include-other-diary-files) |
751 (pop-up-frames (or pop-up-frames | 821 (pop-up-frames (or pop-up-frames |
752 (window-dedicated-p (selected-window))))) | 822 (window-dedicated-p (selected-window))))) |
753 (calendar-set-mode-line (format "Diary for %s" hol-string)) | 823 (calendar-set-mode-line (format "Diary for %s" hol-string)) |
754 (if (or (not diary-entries-list) | 824 (if (or (not diary-entries-list) |
755 (and (not (cdr diary-entries-list)) | 825 (and (not (cdr diary-entries-list)) |
756 (string-equal (car (cdr (car diary-entries-list))) ""))) | 826 (string-equal (cadr (car diary-entries-list)) ""))) |
757 (if (< (length msg) (frame-width)) | 827 (if (< (length msg) (frame-width)) |
758 (message "%s" msg) | 828 (message "%s" msg) |
759 (set-buffer (get-buffer-create holiday-buffer)) | 829 (set-buffer (get-buffer-create holiday-buffer)) |
760 (setq buffer-read-only nil) | 830 (setq buffer-read-only nil) |
761 (calendar-set-mode-line date-string) | 831 (calendar-set-mode-line date-string) |
785 (define-button-type 'diary-entry | 855 (define-button-type 'diary-entry |
786 'action #'diary-goto-entry | 856 'action #'diary-goto-entry |
787 'face 'diary-button) | 857 'face 'diary-button) |
788 | 858 |
789 (defun diary-goto-entry (button) | 859 (defun diary-goto-entry (button) |
790 "Jump to the diary entry for the button at point." | 860 "Jump to the diary entry for the BUTTON at point." |
791 (let* ((locator (button-get button 'locator)) | 861 (let* ((locator (button-get button 'locator)) |
792 (marker (car locator)) | 862 (marker (car locator)) |
793 markbuf file) | 863 markbuf file) |
794 ;; If marker pointing to diary location is valid, use that. | 864 ;; If marker pointing to diary location is valid, use that. |
795 (if (and marker (setq markbuf (marker-buffer marker))) | 865 (if (and marker (setq markbuf (marker-buffer marker))) |
817 (with-current-buffer | 887 (with-current-buffer |
818 (find-buffer-visiting (substitute-in-file-name diary-file)) | 888 (find-buffer-visiting (substitute-in-file-name diary-file)) |
819 (diary-unhide-everything)) | 889 (diary-unhide-everything)) |
820 (if (or (not diary-entries-list) | 890 (if (or (not diary-entries-list) |
821 (and (not (cdr diary-entries-list)) | 891 (and (not (cdr diary-entries-list)) |
822 (string-equal (car (cdr (car diary-entries-list))) ""))) | 892 (string-equal (cadr (car diary-entries-list)) ""))) |
823 (let* ((holiday-list (if holidays-in-diary-buffer | 893 (let* ((holiday-list (if holidays-in-diary-buffer |
824 (calendar-check-holidays original-date))) | 894 (calendar-check-holidays original-date))) |
825 (msg (format "No diary entries for %s %s" | 895 (msg (format "No diary entries for %s %s" |
826 (concat date-string (if holiday-list ":" "")) | 896 (concat date-string (if holiday-list ":" "")) |
827 (mapconcat 'identity holiday-list "; ")))) | 897 (mapconcat 'identity holiday-list "; ")))) |
844 (holiday-list) | 914 (holiday-list) |
845 (holiday-list-last-month 1) | 915 (holiday-list-last-month 1) |
846 (holiday-list-last-year 1) | 916 (holiday-list-last-year 1) |
847 (date (list 0 0 0))) | 917 (date (list 0 0 0))) |
848 (dolist (entry entry-list) | 918 (dolist (entry entry-list) |
849 (if (not (calendar-date-equal date (car entry))) | 919 (unless (calendar-date-equal date (car entry)) |
850 (progn | 920 (setq date (car entry)) |
851 (setq date (car entry)) | 921 (and holidays-in-diary-buffer |
852 (and holidays-in-diary-buffer | 922 (calendar-date-compare |
853 (calendar-date-compare | 923 (list (list holiday-list-last-month |
854 (list (list holiday-list-last-month | 924 (calendar-last-day-of-month |
855 (calendar-last-day-of-month | 925 holiday-list-last-month |
856 holiday-list-last-month | 926 holiday-list-last-year) |
857 holiday-list-last-year) | 927 holiday-list-last-year)) |
858 holiday-list-last-year)) | 928 (list date)) |
859 (list date)) | 929 ;; We need to get the holidays for the next 3 months. |
860 ;; We need to get the holidays for the next 3 months. | 930 (setq holiday-list-last-month |
861 (setq holiday-list-last-month | 931 (extract-calendar-month date) |
862 (extract-calendar-month date) | 932 holiday-list-last-year |
863 holiday-list-last-year | 933 (extract-calendar-year date)) |
864 (extract-calendar-year date)) | 934 (progn |
865 (progn | 935 (increment-calendar-month |
866 (increment-calendar-month | 936 holiday-list-last-month holiday-list-last-year 1) |
867 holiday-list-last-month holiday-list-last-year 1) | 937 t) |
868 t) | 938 (setq holiday-list |
869 (setq holiday-list | 939 (let ((displayed-month holiday-list-last-month) |
870 (let ((displayed-month holiday-list-last-month) | 940 (displayed-year holiday-list-last-year)) |
871 (displayed-year holiday-list-last-year)) | 941 (calendar-holiday-list))) |
872 (calendar-holiday-list))) | 942 (increment-calendar-month |
873 (increment-calendar-month | 943 holiday-list-last-month holiday-list-last-year 1)) |
874 holiday-list-last-month holiday-list-last-year 1)) | 944 (let (date-holiday-list) |
875 (let (date-holiday-list) | 945 ;; Make a list of all holidays for date. |
876 ;; Make a list of all holidays for date. | 946 (dolist (h holiday-list) |
877 (dolist (h holiday-list) | 947 (if (calendar-date-equal date (car h)) |
878 (if (calendar-date-equal date (car h)) | 948 (setq date-holiday-list (append date-holiday-list |
879 (setq date-holiday-list (append date-holiday-list | 949 (cdr h))))) |
880 (cdr h))))) | 950 (insert (if (bobp) "" ?\n) (calendar-date-string date)) |
881 (insert (if (bobp) "" ?\n) (calendar-date-string date)) | 951 (if date-holiday-list (insert ": ")) |
882 (if date-holiday-list (insert ": ")) | 952 (let ((l (current-column)) |
883 (let ((l (current-column)) | 953 (longest 0)) |
884 (longest 0)) | 954 (insert (mapconcat (lambda (x) |
885 (insert (mapconcat (lambda (x) | 955 (if (< longest (length x)) |
886 (if (< longest (length x)) | 956 (setq longest (length x))) |
887 (setq longest (length x))) | 957 x) |
888 x) | 958 date-holiday-list |
889 date-holiday-list | 959 (concat "\n" (make-string l ? )))) |
890 (concat "\n" (make-string l ? )))) | 960 (insert ?\n (make-string (+ l longest) ?=) ?\n)))) |
891 (insert ?\n (make-string (+ l longest) ?=) ?\n))))) | |
892 (let ((this-entry (cadr entry)) | 961 (let ((this-entry (cadr entry)) |
893 this-loc) | 962 this-loc) |
894 (unless (zerop (length this-entry)) | 963 (unless (zerop (length this-entry)) |
895 (if (setq this-loc (nth 3 entry)) | 964 (if (setq this-loc (nth 3 entry)) |
896 (insert-button (concat this-entry "\n") | 965 (insert-button (concat this-entry "\n") |
1071 "True during the marking of diary entries, nil otherwise.") | 1140 "True during the marking of diary entries, nil otherwise.") |
1072 | 1141 |
1073 (defvar marking-diary-entry nil | 1142 (defvar marking-diary-entry nil |
1074 "True during the marking of diary entries, if current entry is marking.") | 1143 "True during the marking of diary entries, if current entry is marking.") |
1075 | 1144 |
1145 ;; FIXME use for mark-diary-entries. | |
1146 (defun diary-mark-entries-1 (months symbol absfunc markfunc) | |
1147 "Mark diary entries of a certain type. | |
1148 MONTHS is an array of month names. SYMBOL marks diary entries of the type | |
1149 in question. ABSFUNC is a function that converts absolute dates to dates | |
1150 of the appropriate type. MARKFUNC is a function that marks entries | |
1151 of the appropriate type matching a given date pattern." | |
1152 (let ((dayname (diary-name-pattern calendar-day-name-array | |
1153 calendar-day-abbrev-array)) | |
1154 (monthname (format "%s\\|\\*" (diary-name-pattern months))) | |
1155 (month "[0-9]+\\|\\*") | |
1156 (day "[0-9]+\\|\\*") | |
1157 (year "[0-9]+\\|\\*") | |
1158 (case-fold-search t)) | |
1159 (dolist (date-form diary-date-forms) | |
1160 (if (eq (car date-form) 'backup) ; ignore 'backup directive | |
1161 (setq date-form (cdr date-form))) | |
1162 (let* ((l (length date-form)) | |
1163 (d-name-pos (- l (length (memq 'dayname date-form)))) | |
1164 (d-name-pos (if (/= l d-name-pos) (+ 2 d-name-pos))) | |
1165 (m-name-pos (- l (length (memq 'monthname date-form)))) | |
1166 (m-name-pos (if (/= l m-name-pos) (+ 2 m-name-pos))) | |
1167 (d-pos (- l (length (memq 'day date-form)))) | |
1168 (d-pos (if (/= l d-pos) (+ 2 d-pos))) | |
1169 (m-pos (- l (length (memq 'month date-form)))) | |
1170 (m-pos (if (/= l m-pos) (+ 2 m-pos))) | |
1171 (y-pos (- l (length (memq 'year date-form)))) | |
1172 (y-pos (if (/= l y-pos) (+ 2 y-pos))) | |
1173 (regexp (format "^%s\\(%s\\)" (regexp-quote symbol) | |
1174 (mapconcat 'eval date-form "\\)\\(")))) | |
1175 (goto-char (point-min)) | |
1176 (while (re-search-forward regexp nil t) | |
1177 (let* ((dd-name | |
1178 (if d-name-pos | |
1179 (buffer-substring | |
1180 (match-beginning d-name-pos) | |
1181 (match-end d-name-pos)))) | |
1182 (mm-name | |
1183 (if m-name-pos | |
1184 (buffer-substring | |
1185 (match-beginning m-name-pos) | |
1186 (match-end m-name-pos)))) | |
1187 (mm (string-to-number | |
1188 (if m-pos | |
1189 (buffer-substring | |
1190 (match-beginning m-pos) | |
1191 (match-end m-pos)) | |
1192 ""))) | |
1193 (dd (string-to-number | |
1194 (if d-pos | |
1195 (buffer-substring | |
1196 (match-beginning d-pos) | |
1197 (match-end d-pos)) | |
1198 ""))) | |
1199 (y-str (if y-pos | |
1200 (buffer-substring | |
1201 (match-beginning y-pos) | |
1202 (match-end y-pos)))) | |
1203 (yy (if (not y-str) | |
1204 0 | |
1205 (if (and (= (length y-str) 2) | |
1206 abbreviated-calendar-year) | |
1207 (let* ((current-y | |
1208 (extract-calendar-year | |
1209 (funcall absfunc | |
1210 (calendar-absolute-from-gregorian | |
1211 (calendar-current-date))))) | |
1212 (y (+ (string-to-number y-str) | |
1213 (* 100 (/ current-y 100))))) | |
1214 (if (> (- y current-y) 50) | |
1215 (- y 100) | |
1216 (if (> (- current-y y) 50) | |
1217 (+ y 100) | |
1218 y))) | |
1219 (string-to-number y-str))))) | |
1220 (if dd-name | |
1221 (mark-calendar-days-named | |
1222 (cdr (assoc-string dd-name | |
1223 (calendar-make-alist | |
1224 calendar-day-name-array | |
1225 0 nil calendar-day-abbrev-array) t))) | |
1226 (if mm-name | |
1227 (setq mm | |
1228 (if (string-equal mm-name "*") 0 | |
1229 (cdr (assoc-string | |
1230 mm-name | |
1231 (calendar-make-alist months) t))))) | |
1232 (funcall markfunc mm dd yy)))))))) | |
1233 | |
1076 ;;;###cal-autoload | 1234 ;;;###cal-autoload |
1077 (defun mark-diary-entries (&optional redraw) | 1235 (defun mark-diary-entries (&optional redraw) |
1078 "Mark days in the calendar window that have diary entries. | 1236 "Mark days in the calendar window that have diary entries. |
1079 Each entry in the diary file visible in the calendar window is | 1237 Each entry in the diary file visible in the calendar window is |
1080 marked. After the entries are marked, the hooks | 1238 marked. After the entries are marked, the hooks |
1115 (dolist (date-form diary-date-forms) | 1273 (dolist (date-form diary-date-forms) |
1116 (if (eq (car date-form) 'backup) | 1274 (if (eq (car date-form) 'backup) |
1117 (setq date-form (cdr date-form))) ; ignore 'backup directive | 1275 (setq date-form (cdr date-form))) ; ignore 'backup directive |
1118 (let* ((l (length date-form)) | 1276 (let* ((l (length date-form)) |
1119 (d-name-pos (- l (length (memq 'dayname date-form)))) | 1277 (d-name-pos (- l (length (memq 'dayname date-form)))) |
1120 (d-name-pos (if (/= l d-name-pos) (+ 1 d-name-pos))) | 1278 (d-name-pos (if (/= l d-name-pos) (1+ d-name-pos))) |
1121 (m-name-pos (- l (length (memq 'monthname date-form)))) | 1279 (m-name-pos (- l (length (memq 'monthname date-form)))) |
1122 (m-name-pos (if (/= l m-name-pos) (+ 1 m-name-pos))) | 1280 (m-name-pos (if (/= l m-name-pos) (1+ m-name-pos))) |
1123 (d-pos (- l (length (memq 'day date-form)))) | 1281 (d-pos (- l (length (memq 'day date-form)))) |
1124 (d-pos (if (/= l d-pos) (+ 1 d-pos))) | 1282 (d-pos (if (/= l d-pos) (1+ d-pos))) |
1125 (m-pos (- l (length (memq 'month date-form)))) | 1283 (m-pos (- l (length (memq 'month date-form)))) |
1126 (m-pos (if (/= l m-pos) (+ 1 m-pos))) | 1284 (m-pos (if (/= l m-pos) (1+ m-pos))) |
1127 (y-pos (- l (length (memq 'year date-form)))) | 1285 (y-pos (- l (length (memq 'year date-form)))) |
1128 (y-pos (if (/= l y-pos) (+ 1 y-pos))) | 1286 (y-pos (if (/= l y-pos) (1+ y-pos))) |
1129 (regexp | 1287 (regexp |
1130 (concat | 1288 (concat |
1131 "^\\(" | 1289 "^\\(" |
1132 (mapconcat 'eval date-form "\\)\\(") | 1290 (mapconcat 'eval date-form "\\)\\(") |
1133 "\\)")) | 1291 "\\)")) |
1236 (while (looking-at "[ \t]") | 1394 (while (looking-at "[ \t]") |
1237 (forward-line 1)) | 1395 (forward-line 1)) |
1238 (if (bolp) (backward-char 1)) | 1396 (if (bolp) (backward-char 1)) |
1239 (setq entry (buffer-substring-no-properties entry-start (point)))) | 1397 (setq entry (buffer-substring-no-properties entry-start (point)))) |
1240 (calendar-for-loop date from first-date to last-date do | 1398 (calendar-for-loop date from first-date to last-date do |
1241 (if (setq mark | 1399 (when (setq mark |
1242 (diary-sexp-entry sexp entry | 1400 (diary-sexp-entry |
1243 (calendar-gregorian-from-absolute date))) | 1401 sexp entry |
1244 (progn | 1402 (calendar-gregorian-from-absolute |
1245 ;; FIXME what? | 1403 date))) |
1246 (setq marks (diary-pull-attrs | 1404 ;; FIXME does this make sense? |
1247 entry file-glob-attrs) | 1405 (setq marks (diary-pull-attrs |
1248 marks (nth 1 (diary-pull-attrs | 1406 entry file-glob-attrs) |
1249 entry file-glob-attrs))) | 1407 marks (nth 1 (diary-pull-attrs |
1250 (mark-visible-calendar-date | 1408 entry file-glob-attrs))) |
1251 (calendar-gregorian-from-absolute date) | 1409 (mark-visible-calendar-date |
1252 (if (< 0 (length marks)) | 1410 (calendar-gregorian-from-absolute date) |
1253 marks | 1411 (if (< 0 (length marks)) |
1254 (if (consp mark) | 1412 marks |
1255 (car mark))))))))))) | 1413 (if (consp mark) |
1414 (car mark)))))))))) | |
1256 | 1415 |
1257 (defun mark-included-diary-files () | 1416 (defun mark-included-diary-files () |
1258 "Mark the diary entries from other diary files with those of the diary file. | 1417 "Mark the diary entries from other diary files with those of the diary file. |
1259 This function is suitable for use as the `mark-diary-entries-hook'; it enables | 1418 This function is suitable for use as the `mark-diary-entries-hook'; it enables |
1260 you to use shared diary files together with your own. The files included are | 1419 you to use shared diary files together with your own. The files included are |
1263 This is recursive; that is, #include directives in diary files thus included | 1422 This is recursive; that is, #include directives in diary files thus included |
1264 are obeyed. You can change the `#include' to some other string by | 1423 are obeyed. You can change the `#include' to some other string by |
1265 changing the variable `diary-include-string'." | 1424 changing the variable `diary-include-string'." |
1266 (goto-char (point-min)) | 1425 (goto-char (point-min)) |
1267 (while (re-search-forward | 1426 (while (re-search-forward |
1268 (concat | 1427 (format "^%s \"\\([^\"]*\\)\"" (regexp-quote diary-include-string)) |
1269 "^" | |
1270 (regexp-quote diary-include-string) | |
1271 " \"\\([^\"]*\\)\"") | |
1272 nil t) | 1428 nil t) |
1273 (let* ((diary-file (substitute-in-file-name | 1429 (let* ((diary-file (substitute-in-file-name |
1274 (match-string-no-properties 1))) | 1430 (match-string-no-properties 1))) |
1275 (mark-diary-entries-hook 'mark-included-diary-files) | 1431 (mark-diary-entries-hook 'mark-included-diary-files) |
1276 (dbuff (find-buffer-visiting diary-file))) | 1432 (dbuff (find-buffer-visiting diary-file))) |
1329 (if (or (and (= month p-month) | 1485 (if (or (and (= month p-month) |
1330 (or (zerop p-year) (= year p-year))) | 1486 (or (zerop p-year) (= year p-year))) |
1331 (and (zerop p-month) | 1487 (and (zerop p-month) |
1332 (or (zerop p-year) (= year p-year)))) | 1488 (or (zerop p-year) (= year p-year)))) |
1333 (if (zerop p-day) | 1489 (if (zerop p-day) |
1334 (calendar-for-loop | 1490 (dotimes (i (calendar-last-day-of-month month year)) |
1335 i from 1 to (calendar-last-day-of-month month year) do | 1491 (mark-visible-calendar-date (list month (1+ i) year) color)) |
1336 (mark-visible-calendar-date (list month i year) color)) | |
1337 (mark-visible-calendar-date (list month p-day year) color)))) | 1492 (mark-visible-calendar-date (list month p-day year) color)))) |
1338 | 1493 |
1339 (defun sort-diary-entries () | 1494 (defun sort-diary-entries () |
1340 "Sort the list of diary entries by time of day." | 1495 "Sort the list of diary entries by time of day." |
1341 (setq diary-entries-list (sort diary-entries-list 'diary-entry-compare))) | 1496 (setq diary-entries-list (sort diary-entries-list 'diary-entry-compare))) |
1404 | 1559 |
1405 A number of built-in functions are available for this type of diary entry: | 1560 A number of built-in functions are available for this type of diary entry: |
1406 | 1561 |
1407 %%(diary-date MONTH DAY YEAR &optional MARK) text | 1562 %%(diary-date MONTH DAY YEAR &optional MARK) text |
1408 Entry applies if date is MONTH, DAY, YEAR if | 1563 Entry applies if date is MONTH, DAY, YEAR if |
1409 `european-calendar-style' is nil, and DAY, MONTH, YEAR if | 1564 `european-calendar-style' is nil (otherwise DAY, MONTH, |
1410 `european-calendar-style' is t. DAY, MONTH, and YEAR | 1565 YEAR). DAY, MONTH, and YEAR can be lists of integers, |
1411 can be lists of integers, the constant t, or an integer. | 1566 `t' (meaning all values), or an integer. An optional |
1412 The constant t means all values. An optional parameter | 1567 parameter MARK specifies a face or single-character string |
1413 MARK specifies a face or single-character string to use | 1568 to use when highlighting the day in the calendar. |
1414 when highlighting the day in the calendar. | |
1415 | 1569 |
1416 %%(diary-float MONTH DAYNAME N &optional DAY MARK) text | 1570 %%(diary-float MONTH DAYNAME N &optional DAY MARK) text |
1417 Entry will appear on the Nth DAYNAME of MONTH. | 1571 Entry will appear on the Nth DAYNAME of MONTH. |
1418 (DAYNAME=0 means Sunday, 1 means Monday, and so on; | 1572 (DAYNAME=0 means Sunday, 1 means Monday, and so on; |
1419 if N is negative it counts backward from the end of | 1573 if N is negative it counts backward from the end of |
1424 optional parameter MARK specifies a face or single-character | 1578 optional parameter MARK specifies a face or single-character |
1425 string to use when highlighting the day in the calendar. | 1579 string to use when highlighting the day in the calendar. |
1426 | 1580 |
1427 %%(diary-block M1 D1 Y1 M2 D2 Y2 &optional MARK) text | 1581 %%(diary-block M1 D1 Y1 M2 D2 Y2 &optional MARK) text |
1428 Entry will appear on dates between M1/D1/Y1 and M2/D2/Y2, | 1582 Entry will appear on dates between M1/D1/Y1 and M2/D2/Y2, |
1429 inclusive. (If `european-calendar-style' is t, the | 1583 inclusive. (If `european-calendar-style' is non-nil, the |
1430 order of the parameters should be changed to D1, M1, Y1, | 1584 order of the parameters should be changed to D1, M1, Y1, |
1431 D2, M2, Y2.) An optional parameter MARK specifies a face | 1585 D2, M2, Y2.) An optional parameter MARK specifies a face |
1432 or single-character string to use when highlighting the | 1586 or single-character string to use when highlighting the |
1433 day in the calendar. | 1587 day in the calendar. |
1434 | 1588 |
1435 %%(diary-anniversary MONTH DAY YEAR &optional MARK) text | 1589 %%(diary-anniversary MONTH DAY YEAR &optional MARK) text |
1436 Entry will appear on anniversary dates of MONTH DAY, YEAR. | 1590 Entry will appear on anniversary dates of MONTH DAY, YEAR. |
1437 (If `european-calendar-style' is t, the order of the | 1591 (If `european-calendar-style' is non-nil, the order of the |
1438 parameters should be changed to DAY, MONTH, YEAR.) Text | 1592 parameters should be changed to DAY, MONTH, YEAR.) Text |
1439 can contain %d or %d%s; %d will be replaced by the number | 1593 can contain %d or %d%s; %d will be replaced by the number |
1440 of years since the MONTH DAY, YEAR and %s will be replaced | 1594 of years since the MONTH DAY, YEAR and %s will be replaced |
1441 by the ordinal ending of that number (that is, `st', `nd', | 1595 by the ordinal ending of that number (that is, `st', `nd', |
1442 `rd' or `th', as appropriate. The anniversary of February | 1596 `rd' or `th', as appropriate. The anniversary of February |
1444 optional parameter MARK specifies a face or single-character | 1598 optional parameter MARK specifies a face or single-character |
1445 string to use when highlighting the day in the calendar. | 1599 string to use when highlighting the day in the calendar. |
1446 | 1600 |
1447 %%(diary-cyclic N MONTH DAY YEAR &optional MARK) text | 1601 %%(diary-cyclic N MONTH DAY YEAR &optional MARK) text |
1448 Entry will appear every N days, starting MONTH DAY, YEAR. | 1602 Entry will appear every N days, starting MONTH DAY, YEAR. |
1449 (If `european-calendar-style' is t, the order of the | 1603 (If `european-calendar-style' is non-nil, the order of the |
1450 parameters should be changed to N, DAY, MONTH, YEAR.) Text | 1604 parameters should be changed to N, DAY, MONTH, YEAR.) Text |
1451 can contain %d or %d%s; %d will be replaced by the number | 1605 can contain %d or %d%s; %d will be replaced by the number |
1452 of repetitions since the MONTH DAY, YEAR and %s will | 1606 of repetitions since the MONTH DAY, YEAR and %s will |
1453 be replaced by the ordinal ending of that number (that is, | 1607 be replaced by the ordinal ending of that number (that is, |
1454 `st', `nd', `rd' or `th', as appropriate. An optional | 1608 `st', `nd', `rd' or `th', as appropriate. An optional |
1518 | 1672 |
1519 %%(diary-yahrzeit MONTH DAY YEAR) text | 1673 %%(diary-yahrzeit MONTH DAY YEAR) text |
1520 Text is assumed to be the name of the person; the date is | 1674 Text is assumed to be the name of the person; the date is |
1521 the date of death on the *civil* calendar. The diary entry | 1675 the date of death on the *civil* calendar. The diary entry |
1522 will appear on the proper Hebrew-date anniversary and on the | 1676 will appear on the proper Hebrew-date anniversary and on the |
1523 day before. (If `european-calendar-style' is t, the order | 1677 day before. (If `european-calendar-style' is non-nil, the |
1524 of the parameters should be changed to DAY, MONTH, YEAR.) | 1678 parameter order should be changed to DAY, MONTH, YEAR.) |
1525 | 1679 |
1526 %%(diary-rosh-hodesh) | 1680 %%(diary-rosh-hodesh) |
1527 Diary entries will be made on the dates of Rosh Hodesh on | 1681 Diary entries will be made on the dates of Rosh Hodesh on |
1528 the Hebrew calendar. Note that since there is no text, it | 1682 the Hebrew calendar. Note that since there is no text, it |
1529 makes sense only if the fancy diary display is used. | 1683 makes sense only if the fancy diary display is used. |
1575 temp literal) | 1729 temp literal) |
1576 (setq literal entry ; before evaluation | 1730 (setq literal entry ; before evaluation |
1577 entry (if (consp diary-entry) | 1731 entry (if (consp diary-entry) |
1578 (cdr diary-entry) | 1732 (cdr diary-entry) |
1579 diary-entry)) | 1733 diary-entry)) |
1580 (if diary-entry | 1734 (when diary-entry |
1581 (progn | 1735 (remove-overlays line-start (point) 'invisible 'diary) |
1582 (remove-overlays line-start (point) 'invisible 'diary) | 1736 (if (< 0 (length entry)) |
1583 (if (< 0 (length entry)) | 1737 (setq temp (diary-pull-attrs entry file-glob-attrs) |
1584 (setq temp (diary-pull-attrs entry file-glob-attrs) | 1738 entry (nth 0 temp) |
1585 entry (nth 0 temp) | 1739 marks (nth 1 temp)))) |
1586 marks (nth 1 temp))))) | |
1587 (add-to-diary-list date | 1740 (add-to-diary-list date |
1588 entry | 1741 entry |
1589 specifier | 1742 specifier |
1590 (if entry-start (copy-marker entry-start) | 1743 (if entry-start (copy-marker entry-start)) |
1591 nil) | |
1592 marks | 1744 marks |
1593 literal) | 1745 literal) |
1594 (setq entry-found (or entry-found diary-entry))))) | 1746 (setq entry-found (or entry-found diary-entry))))) |
1595 entry-found)) | 1747 entry-found)) |
1596 | 1748 |
1618 | 1770 |
1619 ;; To be called from diary-sexp-entry, where DATE, ENTRY are bound. | 1771 ;; To be called from diary-sexp-entry, where DATE, ENTRY are bound. |
1620 (defun diary-date (month day year &optional mark) | 1772 (defun diary-date (month day year &optional mark) |
1621 "Specific date(s) diary entry. | 1773 "Specific date(s) diary entry. |
1622 Entry applies if date is MONTH, DAY, YEAR if `european-calendar-style' is nil, | 1774 Entry applies if date is MONTH, DAY, YEAR if `european-calendar-style' is nil, |
1623 and DAY, MONTH, YEAR if `european-calendar-style' is t. DAY, MONTH, and YEAR | 1775 and DAY, MONTH, YEAR otherwise. DAY, MONTH, and YEAR can be lists of |
1624 can be lists of integers, the constant t, or an integer. The constant t means | 1776 integers, `t' (meaning all values), or an integer. |
1625 all values. | |
1626 | 1777 |
1627 An optional parameter MARK specifies a face or single-character string to | 1778 An optional parameter MARK specifies a face or single-character string to |
1628 use when highlighting the day in the calendar." | 1779 use when highlighting the day in the calendar." |
1629 (let ((dd (if european-calendar-style | 1780 (let ((dd (if european-calendar-style |
1630 month | 1781 month |
1649 | 1800 |
1650 ;; To be called from diary-sexp-entry, where DATE, ENTRY are bound. | 1801 ;; To be called from diary-sexp-entry, where DATE, ENTRY are bound. |
1651 (defun diary-block (m1 d1 y1 m2 d2 y2 &optional mark) | 1802 (defun diary-block (m1 d1 y1 m2 d2 y2 &optional mark) |
1652 "Block diary entry. | 1803 "Block diary entry. |
1653 Entry applies if date is between, or on one of, two dates. | 1804 Entry applies if date is between, or on one of, two dates. |
1654 The order of the parameters is | 1805 The order of the parameters is M1, D1, Y1, M2, D2, Y2 if |
1655 M1, D1, Y1, M2, D2, Y2 if `european-calendar-style' is nil, and | 1806 `european-calendar-style' is nil, and D1, M1, Y1, D2, M2, Y2 otherwise. |
1656 D1, M1, Y1, D2, M2, Y2 if `european-calendar-style' is t. | |
1657 | 1807 |
1658 An optional parameter MARK specifies a face or single-character string to | 1808 An optional parameter MARK specifies a face or single-character string to |
1659 use when highlighting the day in the calendar." | 1809 use when highlighting the day in the calendar." |
1660 | 1810 |
1661 (let ((date1 (calendar-absolute-from-gregorian | 1811 (let ((date1 (calendar-absolute-from-gregorian |
1671 (cons mark entry)))) | 1821 (cons mark entry)))) |
1672 | 1822 |
1673 ;; To be called from diary-sexp-entry, where DATE, ENTRY are bound. | 1823 ;; To be called from diary-sexp-entry, where DATE, ENTRY are bound. |
1674 (defun diary-float (month dayname n &optional day mark) | 1824 (defun diary-float (month dayname n &optional day mark) |
1675 "Floating diary entry--entry applies if date is the nth dayname of month. | 1825 "Floating diary entry--entry applies if date is the nth dayname of month. |
1676 Parameters are MONTH, DAYNAME, N. MONTH can be a list of months, the constant | 1826 Parameters are MONTH, DAYNAME, N. MONTH can be a list of months, an integer, |
1677 t, or an integer. The constant t means all months. If N is negative, count | 1827 or `t' (meaning all months). If N is negative, count backward from the end |
1678 backward from the end of the month. | 1828 of the month. |
1679 | 1829 |
1680 An optional parameter DAY means the Nth DAYNAME on or after/before MONTH DAY. | 1830 An optional parameter DAY means the Nth DAYNAME on or after/before MONTH DAY. |
1681 Optional MARK specifies a face or single-character string to use when | 1831 Optional MARK specifies a face or single-character string to use when |
1682 highlighting the day in the calendar." | 1832 highlighting the day in the calendar." |
1683 ;; This is messy because the diary entry may apply, but the date on which it | 1833 ;; This is messy because the diary entry may apply, but the date on which it |
1738 | 1888 |
1739 ;; To be called from diary-sexp-entry, where DATE, ENTRY are bound. | 1889 ;; To be called from diary-sexp-entry, where DATE, ENTRY are bound. |
1740 (defun diary-anniversary (month day &optional year mark) | 1890 (defun diary-anniversary (month day &optional year mark) |
1741 "Anniversary diary entry. | 1891 "Anniversary diary entry. |
1742 Entry applies if date is the anniversary of MONTH, DAY, YEAR if | 1892 Entry applies if date is the anniversary of MONTH, DAY, YEAR if |
1743 `european-calendar-style' is nil, and DAY, MONTH, YEAR if | 1893 `european-calendar-style' is nil, and DAY, MONTH, YEAR otherwise. The |
1744 `european-calendar-style' is t. Diary entry can contain `%d' or `%d%s'; the | 1894 diary entry can contain `%d' or `%d%s'; the %d will be replaced by the |
1745 %d will be replaced by the number of years since the MONTH DAY, YEAR and the | 1895 number of years since the MONTH DAY, YEAR and the %s will be replaced by |
1746 %s will be replaced by the ordinal ending of that number (that is, `st', `nd', | 1896 the ordinal ending of that number (that is, `st', `nd', `rd' or `th', as |
1747 `rd' or `th', as appropriate. The anniversary of February 29 is considered | 1897 appropriate. The anniversary of February 29 is considered to be March 1 |
1748 to be March 1 in non-leap years. | 1898 in non-leap years. |
1749 | 1899 |
1750 An optional parameter MARK specifies a face or single-character string to | 1900 An optional parameter MARK specifies a face or single-character string to |
1751 use when highlighting the day in the calendar." | 1901 use when highlighting the day in the calendar." |
1752 (let* ((d (if european-calendar-style | 1902 (let* ((d (if european-calendar-style |
1753 month | 1903 month |
1764 (cons mark (format entry diff (diary-ordinal-suffix diff)))))) | 1914 (cons mark (format entry diff (diary-ordinal-suffix diff)))))) |
1765 | 1915 |
1766 ;; To be called from diary-sexp-entry, where DATE, ENTRY are bound. | 1916 ;; To be called from diary-sexp-entry, where DATE, ENTRY are bound. |
1767 (defun diary-cyclic (n month day year &optional mark) | 1917 (defun diary-cyclic (n month day year &optional mark) |
1768 "Cycle diary entry--entry applies every N days starting at MONTH, DAY, YEAR. | 1918 "Cycle diary entry--entry applies every N days starting at MONTH, DAY, YEAR. |
1769 If `european-calendar-style' is t, parameters are N, DAY, MONTH, YEAR. | 1919 If `european-calendar-style' is non-nil, parameters are N, DAY, MONTH, YEAR. |
1770 ENTRY can contain `%d' or `%d%s'; the %d will be replaced by the number of | 1920 ENTRY can contain `%d' or `%d%s'; the %d will be replaced by the number of |
1771 repetitions since the MONTH DAY, YEAR and %s will be replaced by the | 1921 repetitions since the MONTH DAY, YEAR and %s will be replaced by the |
1772 ordinal ending of that number (that is, `st', `nd', `rd' or `th', as | 1922 ordinal ending of that number (that is, `st', `nd', `rd' or `th', as |
1773 appropriate. | 1923 appropriate. |
1774 | 1924 |
2032 | 2182 |
2033 ;; If region looks like it might start or end in the middle of a | 2183 ;; If region looks like it might start or end in the middle of a |
2034 ;; multiline pattern, extend the region to encompass the whole pattern. | 2184 ;; multiline pattern, extend the region to encompass the whole pattern. |
2035 (defun diary-fancy-font-lock-fontify-region-function (beg end &optional verbose) | 2185 (defun diary-fancy-font-lock-fontify-region-function (beg end &optional verbose) |
2036 "Function to use for `font-lock-fontify-region-function' in Fancy Diary. | 2186 "Function to use for `font-lock-fontify-region-function' in Fancy Diary. |
2037 Needed to handle multiline keyword in `fancy-diary-font-lock-keywords'." | 2187 Needed to handle multiline keyword in `fancy-diary-font-lock-keywords'. |
2188 Fontify the region between BEG and END, quietly unless VERBOSE is non-nil." | |
2038 (goto-char beg) | 2189 (goto-char beg) |
2039 (forward-line 0) | 2190 (forward-line 0) |
2040 (if (looking-at "=+$") (forward-line -1)) | 2191 (if (looking-at "=+$") (forward-line -1)) |
2041 (while (and (looking-at " +[^ ]") | 2192 (while (and (looking-at " +[^ ]") |
2042 (zerop (forward-line -1)))) | 2193 (zerop (forward-line -1)))) |
2174 ;; could be run from hooks to notice appointments automatically (in | 2325 ;; could be run from hooks to notice appointments automatically (in |
2175 ;; which case they will prompt about adding to the diary). The | 2326 ;; which case they will prompt about adding to the diary). The |
2176 ;; message formats recognized are customizable through | 2327 ;; message formats recognized are customizable through |
2177 ;; `diary-outlook-formats'. | 2328 ;; `diary-outlook-formats'. |
2178 | 2329 |
2179 ;; Dynamically bound. | 2330 (defvar subject) ; bound in diary-from-outlook-gnus |
2180 (defvar subject) | |
2181 | 2331 |
2182 (defun diary-from-outlook-internal (&optional test-only) | 2332 (defun diary-from-outlook-internal (&optional test-only) |
2183 "Snarf a diary entry from a message assumed to be from MS Outlook. | 2333 "Snarf a diary entry from a message assumed to be from MS Outlook. |
2184 Assumes `body' is bound to a string comprising the body of the message and | 2334 Assumes `body' is bound to a string comprising the body of the message and |
2185 `subject' is bound to a string comprising its subject. | 2335 `subject' is bound to a string comprising its subject. |