diff options
| author | Glenn Morris | 2003-08-03 14:00:56 +0000 |
|---|---|---|
| committer | Glenn Morris | 2003-08-03 14:00:56 +0000 |
| commit | ca2a5950cfe3f0184aba945ee9bc5a086857a876 (patch) | |
| tree | 576ddc2e0dde4c0544f668eb90d8a040a9fd1c99 | |
| parent | 5bb7a2d5747389ef39a02ca04ac211a2e26f8782 (diff) | |
| download | emacs-ca2a5950cfe3f0184aba945ee9bc5a086857a876.tar.gz emacs-ca2a5950cfe3f0184aba945ee9bc5a086857a876.zip | |
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
and `calendar-month-name' functions.
(diary-name-pattern): Use abbrev arrays, rather than fixing abbrevs at
three chars. Calling syntax change.
(mark-diary-entries): Adapt for new behaviours of
`diary-name-pattern' and `calendar-make-alist' functions.
(fancy-diary-font-lock-keywords): Adapt for new behaviour of
`diary-name-pattern' function.
(font-lock-diary-date-forms): Use abbrev arrays, rather than fixing
abbrevs at three chars. Calling syntax change.
(cal-hebrew, cal-islam): Require when compiling.
(diary-font-lock-keywords): Adapt for new behaviour of
`font-lock-diary-date-forms' function.
| -rw-r--r-- | lisp/calendar/diary-lib.el | 114 |
1 files changed, 55 insertions, 59 deletions
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 83f35c279b5..3e516aed3b9 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el | |||
| @@ -341,14 +341,13 @@ These hooks have the following distinct roles: | |||
| 341 | (car d))) | 341 | (car d))) |
| 342 | (backup (equal (car (car d)) 'backup)) | 342 | (backup (equal (car (car d)) 'backup)) |
| 343 | (dayname | 343 | (dayname |
| 344 | (concat | 344 | (format "%s\\|%s\\.?" |
| 345 | (calendar-day-name date) "\\|" | 345 | (calendar-day-name date) |
| 346 | (substring (calendar-day-name date) 0 3) ".?")) | 346 | (calendar-day-name date 'abbrev))) |
| 347 | (monthname | 347 | (monthname |
| 348 | (concat | 348 | (format "\\*\\|%s\\|%s\\.?" |
| 349 | "\\*\\|" | 349 | (calendar-month-name month) |
| 350 | (calendar-month-name month) "\\|" | 350 | (calendar-month-name month 'abbrev))) |
| 351 | (substring (calendar-month-name month) 0 3) ".?")) | ||
| 352 | (month (concat "\\*\\|0*" (int-to-string month))) | 351 | (month (concat "\\*\\|0*" (int-to-string month))) |
| 353 | (day (concat "\\*\\|0*" (int-to-string day))) | 352 | (day (concat "\\*\\|0*" (int-to-string day))) |
| 354 | (year | 353 | (year |
| @@ -410,6 +409,7 @@ These hooks have the following distinct roles: | |||
| 410 | 'list-diary-entries-hook) | 409 | 'list-diary-entries-hook) |
| 411 | (if diary-display-hook | 410 | (if diary-display-hook |
| 412 | (run-hooks 'diary-display-hook) | 411 | (run-hooks 'diary-display-hook) |
| 412 | ;; FIXME Error if calendar-setup 'calendar-only -- gm. | ||
| 413 | (simple-diary-display)) | 413 | (simple-diary-display)) |
| 414 | (run-hooks 'diary-hook) | 414 | (run-hooks 'diary-hook) |
| 415 | diary-entries-list)))) | 415 | diary-entries-list)))) |
| @@ -757,26 +757,23 @@ to run it every morning at 1am." | |||
| 757 | "No entries found")) | 757 | "No entries found")) |
| 758 | (call-interactively (get mail-user-agent 'sendfunc)))) | 758 | (call-interactively (get mail-user-agent 'sendfunc)))) |
| 759 | 759 | ||
| 760 | 760 | (defun diary-name-pattern (string-array &optional abbrev-array paren) | |
| 761 | (defun diary-name-pattern (string-array &optional fullname) | 761 | "Return a regexp matching the strings in the array STRING-ARRAY. |
| 762 | "Convert a STRING-ARRAY, an array of strings to a pattern. | 762 | If the optional argument ABBREV-ARRAY is present, then the function |
| 763 | The pattern will match any of the strings, either entirely or abbreviated | 763 | `calendar-abbrev-construct' is used to construct abbreviations from the |
| 764 | to three characters. An abbreviated form will match with or without a period; | 764 | two supplied arrays. The returned regexp will then also match these |
| 765 | If the optional FULLNAME is t, abbreviations will not match, just the full | 765 | abbreviations, with or without final `.' characters. If the optional |
| 766 | name." | 766 | argument PAREN is non-nil, the regexp is surrounded by parentheses." |
| 767 | (let ((pattern "")) | 767 | (regexp-opt (append string-array |
| 768 | (calendar-for-loop i from 0 to (1- (length string-array)) do | 768 | (if abbrev-array |
| 769 | (setq pattern | 769 | (calendar-abbrev-construct abbrev-array |
| 770 | (concat | 770 | string-array)) |
| 771 | pattern | 771 | (if abbrev-array |
| 772 | (if (string-equal pattern "") "" "\\|") | 772 | (calendar-abbrev-construct abbrev-array |
| 773 | (aref string-array i) | 773 | string-array |
| 774 | (if fullname | 774 | 'period)) |
| 775 | "" | 775 | nil) |
| 776 | (concat | 776 | paren)) |
| 777 | "\\|" | ||
| 778 | (substring (aref string-array i) 0 3) ".?"))))) | ||
| 779 | pattern)) | ||
| 780 | 777 | ||
| 781 | (defvar marking-diary-entries nil | 778 | (defvar marking-diary-entries nil |
| 782 | "True during the marking of diary entries, nil otherwise.") | 779 | "True during the marking of diary entries, nil otherwise.") |
| @@ -805,11 +802,13 @@ After the entries are marked, the hooks `nongregorian-diary-marking-hook' and | |||
| 805 | (let* ((date-form (if (equal (car (car d)) 'backup) | 802 | (let* ((date-form (if (equal (car (car d)) 'backup) |
| 806 | (cdr (car d)) | 803 | (cdr (car d)) |
| 807 | (car d)));; ignore 'backup directive | 804 | (car d)));; ignore 'backup directive |
| 808 | (dayname (diary-name-pattern calendar-day-name-array)) | 805 | (dayname |
| 806 | (diary-name-pattern calendar-day-name-array | ||
| 807 | calendar-day-abbrev-array)) | ||
| 809 | (monthname | 808 | (monthname |
| 810 | (concat | 809 | (format "%s\\|\\*" |
| 811 | (diary-name-pattern calendar-month-name-array) | 810 | (diary-name-pattern calendar-month-name-array |
| 812 | "\\|\\*")) | 811 | calendar-month-abbrev-array))) |
| 813 | (month "[0-9]+\\|\\*") | 812 | (month "[0-9]+\\|\\*") |
| 814 | (day "[0-9]+\\|\\*") | 813 | (day "[0-9]+\\|\\*") |
| 815 | (year "[0-9]+\\|\\*") | 814 | (year "[0-9]+\\|\\*") |
| @@ -883,21 +882,18 @@ After the entries are marked, the hooks `nongregorian-diary-marking-hook' and | |||
| 883 | (if dd-name | 882 | (if dd-name |
| 884 | (mark-calendar-days-named | 883 | (mark-calendar-days-named |
| 885 | (cdr (assoc-ignore-case | 884 | (cdr (assoc-ignore-case |
| 886 | (substring dd-name 0 3) | 885 | dd-name |
| 887 | (calendar-make-alist | 886 | (calendar-make-alist |
| 888 | calendar-day-name-array | 887 | calendar-day-name-array |
| 889 | 0 | 888 | 0 nil calendar-day-abbrev-array))) marks) |
| 890 | (lambda (x) (substring x 0 3))))) marks) | ||
| 891 | (if mm-name | 889 | (if mm-name |
| 892 | (if (string-equal mm-name "*") | 890 | (setq mm |
| 893 | (setq mm 0) | 891 | (if (string-equal mm-name "*") 0 |
| 894 | (setq mm | ||
| 895 | (cdr (assoc-ignore-case | 892 | (cdr (assoc-ignore-case |
| 896 | (substring mm-name 0 3) | 893 | mm-name |
| 897 | (calendar-make-alist | 894 | (calendar-make-alist |
| 898 | calendar-month-name-array | 895 | calendar-month-name-array |
| 899 | 1 | 896 | 1 nil calendar-month-abbrev-array)))))) |
| 900 | (lambda (x) (substring x 0 3)))))))) | ||
| 901 | (mark-calendar-date-pattern mm dd yy marks)))) | 897 | (mark-calendar-date-pattern mm dd yy marks)))) |
| 902 | (setq d (cdr d)))) | 898 | (setq d (cdr d)))) |
| 903 | (mark-sexp-diary-entries) | 899 | (mark-sexp-diary-entries) |
| @@ -1718,14 +1714,8 @@ Prefix arg will make the entry nonmarking." | |||
| 1718 | (list | 1714 | (list |
| 1719 | (cons | 1715 | (cons |
| 1720 | (concat | 1716 | (concat |
| 1721 | (let ((dayname | 1717 | (let ((dayname (diary-name-pattern calendar-day-name-array nil t)) |
| 1722 | (concat "\\(" | 1718 | (monthname (diary-name-pattern calendar-month-name-array nil t)) |
| 1723 | (diary-name-pattern calendar-day-name-array t) | ||
| 1724 | "\\)")) | ||
| 1725 | (monthname | ||
| 1726 | (concat "\\(" | ||
| 1727 | (diary-name-pattern calendar-month-name-array t) | ||
| 1728 | "\\)")) | ||
| 1729 | (day "[0-9]+") | 1719 | (day "[0-9]+") |
| 1730 | (month "[0-9]+") | 1720 | (month "[0-9]+") |
| 1731 | (year "-?[0-9]+")) | 1721 | (year "-?[0-9]+")) |
| @@ -1758,15 +1748,17 @@ Prefix arg will make the entry nonmarking." | |||
| 1758 | t)) | 1748 | t)) |
| 1759 | (error t)))) | 1749 | (error t)))) |
| 1760 | 1750 | ||
| 1761 | (defun font-lock-diary-date-forms (month-list &optional symbol noabbrev) | 1751 | (defun font-lock-diary-date-forms (month-array &optional symbol abbrev-array) |
| 1762 | "Create a list of font-lock patterns for `diary-date-forms' with MONTH-LIST. | 1752 | "Create font-lock patterns for `diary-date-forms' using MONTH-ARRAY. |
| 1763 | If given, optional SYMBOL must be a prefix to entries. | 1753 | If given, optional SYMBOL must be a prefix to entries. |
| 1764 | If optional NOABBREV is t, do not allow abbreviations in names." | 1754 | If optional ABBREV-ARRAY is present, the abbreviations constructed |
| 1765 | (let ((dayname | 1755 | from this array by the function `calendar-abbrev-construct' are |
| 1766 | (concat "\\(" (diary-name-pattern calendar-day-name-array) "\\)")) | 1756 | matched (with or without a final `.'), in addition to the full month |
| 1767 | (monthname (concat "\\(" | 1757 | names." |
| 1768 | (diary-name-pattern month-list noabbrev) | 1758 | (let ((dayname (diary-name-pattern calendar-day-name-array |
| 1769 | "\\|\\*\\)")) | 1759 | calendar-day-abbrev-array t)) |
| 1760 | (monthname (format "\\(%s\\|\\*\\)" | ||
| 1761 | (diary-name-pattern month-array abbrev-array))) | ||
| 1770 | (month "\\([0-9]+\\|\\*\\)") | 1762 | (month "\\([0-9]+\\|\\*\\)") |
| 1771 | (day "\\([0-9]+\\|\\*\\)") | 1763 | (day "\\([0-9]+\\|\\*\\)") |
| 1772 | (year "-?\\([0-9]+\\|\\*\\)")) | 1764 | (year "-?\\([0-9]+\\|\\*\\)")) |
| @@ -1788,9 +1780,13 @@ If optional NOABBREV is t, do not allow abbreviations in names." | |||
| 1788 | '(1 diary-face))) | 1780 | '(1 diary-face))) |
| 1789 | diary-date-forms))) | 1781 | diary-date-forms))) |
| 1790 | 1782 | ||
| 1783 | (eval-when-compile (require 'cal-hebrew) | ||
| 1784 | (require 'cal-islam)) | ||
| 1785 | |||
| 1791 | (defvar diary-font-lock-keywords | 1786 | (defvar diary-font-lock-keywords |
| 1792 | (append | 1787 | (append |
| 1793 | (font-lock-diary-date-forms calendar-month-name-array) | 1788 | (font-lock-diary-date-forms calendar-month-name-array |
| 1789 | nil calendar-month-abbrev-array) | ||
| 1794 | (when (or (memq 'mark-hebrew-diary-entries | 1790 | (when (or (memq 'mark-hebrew-diary-entries |
| 1795 | nongregorian-diary-marking-hook) | 1791 | nongregorian-diary-marking-hook) |
| 1796 | (memq 'list-hebrew-diary-entries | 1792 | (memq 'list-hebrew-diary-entries |
| @@ -1798,7 +1794,7 @@ If optional NOABBREV is t, do not allow abbreviations in names." | |||
| 1798 | (require 'cal-hebrew) | 1794 | (require 'cal-hebrew) |
| 1799 | (font-lock-diary-date-forms | 1795 | (font-lock-diary-date-forms |
| 1800 | calendar-hebrew-month-name-array-leap-year | 1796 | calendar-hebrew-month-name-array-leap-year |
| 1801 | hebrew-diary-entry-symbol t)) | 1797 | hebrew-diary-entry-symbol)) |
| 1802 | (when (or (memq 'mark-islamic-diary-entries | 1798 | (when (or (memq 'mark-islamic-diary-entries |
| 1803 | nongregorian-diary-marking-hook) | 1799 | nongregorian-diary-marking-hook) |
| 1804 | (memq 'list-islamic-diary-entries | 1800 | (memq 'list-islamic-diary-entries |
| @@ -1806,7 +1802,7 @@ If optional NOABBREV is t, do not allow abbreviations in names." | |||
| 1806 | (require 'cal-islam) | 1802 | (require 'cal-islam) |
| 1807 | (font-lock-diary-date-forms | 1803 | (font-lock-diary-date-forms |
| 1808 | calendar-islamic-month-name-array | 1804 | calendar-islamic-month-name-array |
| 1809 | islamic-diary-entry-symbol t)) | 1805 | islamic-diary-entry-symbol)) |
| 1810 | (list | 1806 | (list |
| 1811 | (cons | 1807 | (cons |
| 1812 | (concat "^" (regexp-quote diary-include-string) ".*$") | 1808 | (concat "^" (regexp-quote diary-include-string) ".*$") |