comparison lisp/calendar/diary-lib.el @ 92672:6f28457f84ac

(entry): Declare for compiler part-way through. Comments.
author Glenn Morris <rgm@gnu.org>
date Sat, 08 Mar 2008 23:37:54 +0000
parents e7052a7b4ab1
children 141c5cc6c6fe
comparison
equal deleted inserted replaced
92671:5ab226964d53 92672:6f28457f84ac
746 (unless (and (eobp) (not (bolp))) 746 (unless (and (eobp) (not (bolp)))
747 (backward-char 1)) 747 (backward-char 1))
748 (unless list-only 748 (unless list-only
749 (remove-overlays date-start (point) 749 (remove-overlays date-start (point)
750 'invisible 'diary)) 750 'invisible 'diary))
751 (setq entry (buffer-substring entry-start (point)) 751 ; FIXME free variable entry?
752 temp (diary-pull-attrs entry file-glob-attrs) 752 (setq entry (buffer-substring entry-start (point))
753 entry (nth 0 temp)) 753 temp (diary-pull-attrs entry file-glob-attrs)
754 entry (nth 0 temp))
754 (add-to-diary-list 755 (add-to-diary-list
755 date 756 date
756 entry 757 entry
757 (buffer-substring 758 (buffer-substring
758 (1+ date-start) (1- entry-start)) 759 (1+ date-start) (1- entry-start))
969 x) 970 x)
970 date-holiday-list 971 date-holiday-list
971 (concat "\n" (make-string l ? )))) 972 (concat "\n" (make-string l ? ))))
972 (insert ?\n (make-string (+ l longest) ?=) ?\n))))) 973 (insert ?\n (make-string (+ l longest) ?=) ?\n)))))
973 974
975 ;; FIXME free variable entry?
974 (setq entry (car (cdr (car entry-list)))) 976 (setq entry (car (cdr (car entry-list))))
975 (if (< 0 (length entry)) 977 (if (< 0 (length entry))
976 (let ((this-entry (car entry-list)) 978 (let ((this-entry (car entry-list))
977 this-loc) 979 this-loc)
978 (if (setq this-loc (nth 3 this-entry)) 980 (if (setq this-loc (nth 3 this-entry))
982 (cadr this-loc) 984 (cadr this-loc)
983 (nth 2 this-entry) 985 (nth 2 this-entry)
984 (or (nth 2 this-loc) 986 (or (nth 2 this-loc)
985 (nth 1 this-entry))) 987 (nth 1 this-entry)))
986 :type 'diary-entry) 988 :type 'diary-entry)
989 ; FIXME free variable entry?
987 (insert entry ?\n)) 990 (insert entry ?\n))
988 (save-excursion 991 (save-excursion
989 (let* ((marks (nth 4 this-entry)) 992 (let* ((marks (nth 4 this-entry))
990 (faceinfo marks) 993 (faceinfo marks)
991 temp-face) 994 temp-face)
1249 y))) 1252 y)))
1250 (string-to-number y-str))))) 1253 (string-to-number y-str)))))
1251 (let ((tmp (diary-pull-attrs (buffer-substring-no-properties 1254 (let ((tmp (diary-pull-attrs (buffer-substring-no-properties
1252 (point) (line-end-position)) 1255 (point) (line-end-position))
1253 file-glob-attrs))) 1256 file-glob-attrs)))
1257 ;; FIXME free variable entry.
1254 (setq entry (nth 0 tmp) 1258 (setq entry (nth 0 tmp)
1255 marks (nth 1 tmp))) 1259 marks (nth 1 tmp)))
1256 (if dd-name 1260 (if dd-name
1257 (mark-calendar-days-named 1261 (mark-calendar-days-named
1258 (cdr (assoc-string 1262 (cdr (assoc-string
1680 ((and (consp result) 1684 ((and (consp result)
1681 (stringp (cdr result))) result) 1685 (stringp (cdr result))) result)
1682 (result entry) 1686 (result entry)
1683 (t nil)))) 1687 (t nil))))
1684 1688
1689 (defvar entry)
1690
1691 ;; To be called from diary-sexp-entry, where DATE, ENTRY are bound.
1685 (defun diary-date (month day year &optional mark) 1692 (defun diary-date (month day year &optional mark)
1686 "Specific date(s) diary entry. 1693 "Specific date(s) diary entry.
1687 Entry applies if date is MONTH, DAY, YEAR if `european-calendar-style' is nil, 1694 Entry applies if date is MONTH, DAY, YEAR if `european-calendar-style' is nil,
1688 and DAY, MONTH, YEAR if `european-calendar-style' is t. DAY, MONTH, and YEAR 1695 and DAY, MONTH, YEAR if `european-calendar-style' is t. DAY, MONTH, and YEAR
1689 can be lists of integers, the constant t, or an integer. The constant t means 1696 can be lists of integers, the constant t, or an integer. The constant t means
1710 (or (and (listp year) (memq y year)) 1717 (or (and (listp year) (memq y year))
1711 (equal y year) 1718 (equal y year)
1712 (eq year t))) 1719 (eq year t)))
1713 (cons mark entry)))) 1720 (cons mark entry))))
1714 1721
1722 ;; To be called from diary-sexp-entry, where DATE, ENTRY are bound.
1715 (defun diary-block (m1 d1 y1 m2 d2 y2 &optional mark) 1723 (defun diary-block (m1 d1 y1 m2 d2 y2 &optional mark)
1716 "Block diary entry. 1724 "Block diary entry.
1717 Entry applies if date is between, or on one of, two dates. 1725 Entry applies if date is between, or on one of, two dates.
1718 The order of the parameters is 1726 The order of the parameters is
1719 M1, D1, Y1, M2, D2, Y2 if `european-calendar-style' is nil, and 1727 M1, D1, Y1, M2, D2, Y2 if `european-calendar-style' is nil, and
1732 (list m2 d2 y2)))) 1740 (list m2 d2 y2))))
1733 (d (calendar-absolute-from-gregorian date))) 1741 (d (calendar-absolute-from-gregorian date)))
1734 (if (and (<= date1 d) (<= d date2)) 1742 (if (and (<= date1 d) (<= d date2))
1735 (cons mark entry)))) 1743 (cons mark entry))))
1736 1744
1745 ;; To be called from diary-sexp-entry, where DATE, ENTRY are bound.
1737 (defun diary-float (month dayname n &optional day mark) 1746 (defun diary-float (month dayname n &optional day mark)
1738 "Floating diary entry--entry applies if date is the nth dayname of month. 1747 "Floating diary entry--entry applies if date is the nth dayname of month.
1739 Parameters are MONTH, DAYNAME, N. MONTH can be a list of months, the constant 1748 Parameters are MONTH, DAYNAME, N. MONTH can be a list of months, the constant
1740 t, or an integer. The constant t means all months. If N is negative, count 1749 t, or an integer. The constant t means all months. If N is negative, count
1741 backward from the end of the month. 1750 backward from the end of the month.
1796 1 1805 1
1797 (calendar-last-day-of-month m2 y2))) 1806 (calendar-last-day-of-month m2 y2)))
1798 d2))))) 1807 d2)))))
1799 (cons mark entry))))) 1808 (cons mark entry)))))
1800 1809
1801 1810 ;; To be called from diary-sexp-entry, where DATE, ENTRY are bound.
1802 (defun diary-anniversary (month day &optional year mark) 1811 (defun diary-anniversary (month day &optional year mark)
1803 "Anniversary diary entry. 1812 "Anniversary diary entry.
1804 Entry applies if date is the anniversary of MONTH, DAY, YEAR if 1813 Entry applies if date is the anniversary of MONTH, DAY, YEAR if
1805 `european-calendar-style' is nil, and DAY, MONTH, YEAR if 1814 `european-calendar-style' is nil, and DAY, MONTH, YEAR if
1806 `european-calendar-style' is t. Diary entry can contain `%d' or `%d%s'; the 1815 `european-calendar-style' is t. Diary entry can contain `%d' or `%d%s'; the
1823 (setq m 3 1832 (setq m 3
1824 d 1)) 1833 d 1))
1825 (if (and (> diff 0) (calendar-date-equal (list m d y) date)) 1834 (if (and (> diff 0) (calendar-date-equal (list m d y) date))
1826 (cons mark (format entry diff (diary-ordinal-suffix diff)))))) 1835 (cons mark (format entry diff (diary-ordinal-suffix diff))))))
1827 1836
1837 ;; To be called from diary-sexp-entry, where DATE, ENTRY are bound.
1828 (defun diary-cyclic (n month day year &optional mark) 1838 (defun diary-cyclic (n month day year &optional mark)
1829 "Cycle diary entry--entry applies every N days starting at MONTH, DAY, YEAR. 1839 "Cycle diary entry--entry applies every N days starting at MONTH, DAY, YEAR.
1830 If `european-calendar-style' is t, parameters are N, DAY, MONTH, YEAR. 1840 If `european-calendar-style' is t, parameters are N, DAY, MONTH, YEAR.
1831 ENTRY can contain `%d' or `%d%s'; the %d will be replaced by the number of 1841 ENTRY can contain `%d' or `%d%s'; the %d will be replaced by the number of
1832 repetitions since the MONTH DAY, YEAR and %s will be replaced by the 1842 repetitions since the MONTH DAY, YEAR and %s will be replaced by the