aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2008-03-10 02:46:24 +0000
committerGlenn Morris2008-03-10 02:46:24 +0000
commit21db982bb14c29860cff272e5699338bfbcfc391 (patch)
treec7725595a8a420e7532eeb3850d11fc8dc7f2deb
parent55e8cf9463d9821785fe227537e183f103d29727 (diff)
downloademacs-21db982bb14c29860cff272e5699338bfbcfc391.tar.gz
emacs-21db982bb14c29860cff272e5699338bfbcfc391.zip
(diary-file, hebrew-holidays-1)
(hebrew-holidays-2, hebrew-holidays-3, hebrew-holidays-4) (calendar, calendar-basic-setup, calendar-mode-map, calendar-set-mark) (calendar-version): Doc fixes. (calendar-absolute-from-gregorian): Use zerop. (calendar-mode-line-format): Make it a defcustom.
-rw-r--r--lisp/ChangeLog37
-rw-r--r--lisp/calendar/calendar.el124
2 files changed, 97 insertions, 64 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6c1fb545e24..4239756aacc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,27 @@
12008-03-10 Glenn Morris <rgm@gnu.org>
2
3 * calendar/calendar.el (diary-file, hebrew-holidays-1)
4 (hebrew-holidays-2, hebrew-holidays-3, hebrew-holidays-4)
5 (calendar, calendar-basic-setup, calendar-mode-map, calendar-set-mark)
6 (calendar-version): Doc fixes.
7 (calendar-absolute-from-gregorian): Use zerop.
8 (calendar-mode-line-format): Make it a defcustom.
9
10 * calendar/diary-lib.el (diary-face-attrs): Fix custom :type.
11 (diary-face-attrs, diary-glob-file-regexp-prefix, diary-unknown-time)
12 (diary-pull-attrs, diary-header-line-flag, diary-list-entries)
13 (diary-unhide-everything, include-other-diary-files, diary-goto-entry)
14 (mark-included-diary-files, mark-calendar-days-named)
15 (mark-calendar-date-pattern, mark-calendar-month, diary-entry-compare)
16 (diary-remind, insert-diary-entry, insert-weekly-diary-entry)
17 (insert-monthly-diary-entry, insert-yearly-diary-entry)
18 (insert-anniversary-diary-entry, insert-block-diary-entry)
19 (insert-cyclic-diary-entry, fancy-diary-font-lock-keywords)
20 (diary-font-lock-sexps): Doc fixes.
21 (diary-remind-message, mark-calendar-month): Use zerop.
22 (diary-attrtype-convert, diary-pull-attrs): Simplify.
23 (diary-list-entries): Revert let to let* (previous change).
24
12008-03-10 Kim F. Storm <storm@cua.dk> 252008-03-10 Kim F. Storm <storm@cua.dk>
2 26
3 * help.el (view-emacs-todo, describe-gnu-project): Define obsolete 27 * help.el (view-emacs-todo, describe-gnu-project): Define obsolete
@@ -42,11 +66,11 @@
42 66
43 * doc-view.el (bookmark-buffer-file-name, bookmark-prop-get): Declare. 67 * doc-view.el (bookmark-buffer-file-name, bookmark-prop-get): Declare.
44 (doc-view-bookmark-make-record): Use them. 68 (doc-view-bookmark-make-record): Use them.
45 (doc-view-bookmark-jump): Use them. Fix find-file -> find-file-noselect. 69 (doc-view-bookmark-jump): Use them. Fix find-file ->find-file-noselect.
46 (bookmark-get-filename, bookmark-get-bookmark-record): Remove. 70 (bookmark-get-filename, bookmark-get-bookmark-record): Remove.
47 71
48 * bookmark.el (bookmark-make-record-function): Change expected return value 72 * bookmark.el (bookmark-make-record-function): Change expected return
49 to include a suggested bookmark name. 73 value to include a suggested bookmark name.
50 (bookmark-make): Split into bookmark-make-record and bookmark-store. 74 (bookmark-make): Split into bookmark-make-record and bookmark-store.
51 Fix reversed `overwrite' semantics. 75 Fix reversed `overwrite' semantics.
52 (bookmark-set): Call bookmark-make-record before prompting the user. 76 (bookmark-set): Call bookmark-make-record before prompting the user.
@@ -59,7 +83,7 @@
59 (Info-bookmark-make-record): Use Info-current-node as suggested default 83 (Info-bookmark-make-record): Use Info-current-node as suggested default
60 bookmark name. 84 bookmark name.
61 85
62 * bookmark.el (bookmark-set): Make the bookmark before reading annotations. 86 * bookmark.el (bookmark-set): Make bookmark before reading annotations.
63 I.e. use bookmark-edit-annotation rather than bookmark-read-annotation. 87 I.e. use bookmark-edit-annotation rather than bookmark-read-annotation.
64 (bookmark-read-annotation-mode-map, bookmark-annotation-paragraph) 88 (bookmark-read-annotation-mode-map, bookmark-annotation-paragraph)
65 (bookmark-annotation-buffer, bookmark-annotation-file) 89 (bookmark-annotation-buffer, bookmark-annotation-file)
@@ -67,9 +91,10 @@
67 (bookmark-read-annotation-mode, bookmark-read-annotation): Remove. 91 (bookmark-read-annotation-mode, bookmark-read-annotation): Remove.
68 (bookmark-edit-annotation-text-func): Rename from 92 (bookmark-edit-annotation-text-func): Rename from
69 bookmark-read-annotation-text-func. Keep old name as an obsolete alias. 93 bookmark-read-annotation-text-func. Keep old name as an obsolete alias.
70 (bookmark-edit-annotation-mode-map): Move initialization into declaration. 94 (bookmark-edit-annotation-mode-map): Move initialization into
95 declaration.
71 96
72 * bookmark.el: Add spurious * in docstrings. 97 * bookmark.el: Remove spurious * in docstrings.
73 (bookmark-minibuffer-read-name-map): New var. 98 (bookmark-minibuffer-read-name-map): New var.
74 (bookmark-set): Use it. Also pass the default value as it should. 99 (bookmark-set): Use it. Also pass the default value as it should.
75 (bookmark-send-edited-annotation): Take no chances with text properties. 100 (bookmark-send-edited-annotation): Take no chances with text properties.
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index d36f0beb7c0..b1a0eb2b4a2 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -93,8 +93,6 @@
93 93
94;;; Code: 94;;; Code:
95 95
96(defvar displayed-month)
97(defvar displayed-year)
98 96
99(require 'cal-loaddefs) 97(require 'cal-loaddefs)
100(require 'cal-menu) 98(require 'cal-menu)
@@ -334,12 +332,12 @@ with the remainder of the line being the diary entry string for
334that date. MONTH and DAY are one or two digit numbers, YEAR is a 332that date. MONTH and DAY are one or two digit numbers, YEAR is a
335number and may be written in full or abbreviated to the final two 333number and may be written in full or abbreviated to the final two
336digits (if `abbreviated-calendar-year' is non-nil). MONTHNAME 334digits (if `abbreviated-calendar-year' is non-nil). MONTHNAME
337and DAYNAME can be spelled in full (as specified by the variables 335and DAYNAME can be spelt in full (as specified by the variables
338`calendar-month-name-array' and `calendar-day-name-array'), 336`calendar-month-name-array' and `calendar-day-name-array'),
339abbreviated (as specified by `calendar-month-abbrev-array' and 337abbreviated (as specified by `calendar-month-abbrev-array' and
340`calendar-day-abbrev-array') with or without a period, 338`calendar-day-abbrev-array') with or without a period,
341capitalized or not. Any of DAY, MONTH, or MONTHNAME, YEAR can be 339capitalized or not. Any of DAY, MONTH, or MONTHNAME, YEAR can be
342`*' which matches any day, month, or year, respectively. If the 340`*' which matches any day, month, or year, respectively. If the
343date does not contain a year, it is generic and applies to any 341date does not contain a year, it is generic and applies to any
344year. A DAYNAME entry applies to the appropriate day of the week 342year. A DAYNAME entry applies to the appropriate day of the week
345in every week. 343in every week.
@@ -759,7 +757,8 @@ calendar."
759 (list m 1 y)))))) 757 (list m 1 y))))))
760 (if (zerop (% (1+ year) 4)) 758 (if (zerop (% (1+ year) 4))
761 22 759 22
762 21))) "\"Tal Umatar\" (evening)")))) 760 21))) "\"Tal Umatar\" (evening)")))
761 "Component of the default value of `hebrew-holidays'.")
763;;;###autoload 762;;;###autoload
764(put 'hebrew-holidays-1 'risky-local-variable t) 763(put 'hebrew-holidays-1 'risky-local-variable t)
765 764
@@ -781,7 +780,8 @@ calendar."
781 11 10)) 780 11 10))
782 "Tzom Teveth")) 781 "Tzom Teveth"))
783 (if all-hebrew-calendar-holidays 782 (if all-hebrew-calendar-holidays
784 (holiday-hebrew 11 15 "Tu B'Shevat")))) 783 (holiday-hebrew 11 15 "Tu B'Shevat")))
784 "Component of the default value of `hebrew-holidays'.")
785;;;###autoload 785;;;###autoload
786(put 'hebrew-holidays-2 'risky-local-variable t) 786(put 'hebrew-holidays-2 'risky-local-variable t)
787 787
@@ -814,7 +814,8 @@ calendar."
814 (list 11 16 h-year)))))) 814 (list 11 16 h-year))))))
815 (day (extract-calendar-day s-s))) 815 (day (extract-calendar-day s-s)))
816 day)) 816 day))
817 "Shabbat Shirah")))) 817 "Shabbat Shirah")))
818 "Component of the default value of `hebrew-holidays'.")
818;;;###autoload 819;;;###autoload
819(put 'hebrew-holidays-3 'risky-local-variable t) 820(put 'hebrew-holidays-3 'risky-local-variable t)
820 821
@@ -828,18 +829,19 @@ calendar."
828 (increment-calendar-month m y -1) 829 (increment-calendar-month m y -1)
829 (let ((year (extract-calendar-year 830 (let ((year (extract-calendar-year
830 (calendar-julian-from-absolute 831 (calendar-julian-from-absolute
831 (calendar-absolute-from-gregorian 832 cd - (calendar-absolute-from-gregorian
832 (list m 1 y)))))) 833 (list m 1 y))))))
833 (= 21 (% year 28))))) 834 (= 21 (% year 28)))))
834 (holiday-julian 3 26 "Kiddush HaHamah")) 835 (holiday-julian 3 26 "Kiddush HaHamah"))
835 (if all-hebrew-calendar-holidays 836 (if all-hebrew-calendar-holidays
836 (holiday-tisha-b-av-etc)))) 837 (holiday-tisha-b-av-etc)))
838 "Component of the default value of `hebrew-holidays'.")
837;;;###autoload 839;;;###autoload
838(put 'hebrew-holidays-4 'risky-local-variable t) 840(put 'hebrew-holidays-4 'risky-local-variable t)
839 841
840;;;###autoload 842;;;###autoload
841(defcustom hebrew-holidays (append hebrew-holidays-1 hebrew-holidays-2 843(defcustom hebrew-holidays (append hebrew-holidays-1 hebrew-holidays-2
842 hebrew-holidays-3 hebrew-holidays-4) 844 hebrew-holidays-3 hebrew-holidays-4)
843 "Jewish holidays. 845 "Jewish holidays.
844See the documentation for `calendar-holidays' for details." 846See the documentation for `calendar-holidays' for details."
845 :type 'sexp 847 :type 'sexp
@@ -1172,6 +1174,9 @@ A negative YR is interpreted as BC; -1 being 1 BC, and so on."
1172 (and (< macro-y 0) (> ,mon 1) (setq ,yr (1- ,yr))) 1174 (and (< macro-y 0) (> ,mon 1) (setq ,yr (1- ,yr)))
1173 (if (< ,yr 1) (setq ,yr (1- ,yr))))) ; 0 AD -> -1 BC, etc 1175 (if (< ,yr 1) (setq ,yr (1- ,yr))))) ; 0 AD -> -1 BC, etc
1174 1176
1177(defvar displayed-month)
1178(defvar displayed-year)
1179
1175(defun calendar-increment-month (n &optional mon yr) 1180(defun calendar-increment-month (n &optional mon yr)
1176 "Return the Nth month after MON/YR. 1181 "Return the Nth month after MON/YR.
1177The return value is a pair (MONTH . YEAR). 1182The return value is a pair (MONTH . YEAR).
@@ -1224,8 +1229,6 @@ inclusive."
1224;; 43 calendar-date-equal 1229;; 43 calendar-date-equal
1225;; 38 calendar-gregorian-from-absolute 1230;; 38 calendar-gregorian-from-absolute
1226;; . 1231;; .
1227;; .
1228;; .
1229;; 1232;;
1230;; The use of these seven macros eliminates the overhead of 92% of the function 1233;; The use of these seven macros eliminates the overhead of 92% of the function
1231;; calls; it's faster this way. 1234;; calls; it's faster this way.
@@ -1255,11 +1258,11 @@ A negative year is interpreted as BC; -1 being 1 BC, and so on."
1255;; The foregoing is a bit faster, but not as clear as the following: 1258;; The foregoing is a bit faster, but not as clear as the following:
1256;; 1259;;
1257;;(defsubst calendar-leap-year-p (year) 1260;;(defsubst calendar-leap-year-p (year)
1258;; "Returns t if YEAR is a Gregorian leap year." 1261;; "Return t if YEAR is a Gregorian leap year."
1259;; (or 1262;; (or
1260;; (and (= (% year 4) 0) 1263;; (and (zerop (% year 4))
1261;; (/= (% year 100) 0)) 1264;; (not (zerop (% year 100))))
1262;; (= (% year 400) 0))) 1265;; (zerop (% year 400)))
1263 1266
1264(defsubst calendar-last-day-of-month (month year) 1267(defsubst calendar-last-day-of-month (month year)
1265 "The last day in MONTH during YEAR." 1268 "The last day in MONTH during YEAR."
@@ -1293,12 +1296,12 @@ interpreted as BC; -1 being 1 BC, and so on. Dates before 12/31/1 BC
1293return negative results." 1296return negative results."
1294 (let ((year (extract-calendar-year date)) 1297 (let ((year (extract-calendar-year date))
1295 offset-years) 1298 offset-years)
1296 (cond ((= year 0) 1299 (cond ((zerop year)
1297 (error "There was no year zero")) 1300 (error "There was no year zero"))
1298 ((> year 0) 1301 ((> year 0)
1299 (setq offset-years (1- year)) 1302 (setq offset-years (1- year))
1300 (+ (calendar-day-number date) ; Days this year 1303 (+ (calendar-day-number date) ; days this year
1301 (* 365 offset-years) ; + Days in prior years 1304 (* 365 offset-years) ; + days in prior years
1302 (/ offset-years 4) ; + Julian leap years 1305 (/ offset-years 4) ; + Julian leap years
1303 (- (/ offset-years 100)) ; - century years 1306 (- (/ offset-years 100)) ; - century years
1304 (/ offset-years 400))) ; + Gregorian leap years 1307 (/ offset-years 400))) ; + Gregorian leap years
@@ -1315,7 +1318,7 @@ return negative results."
1315;;;###autoload 1318;;;###autoload
1316(defun calendar (&optional arg) 1319(defun calendar (&optional arg)
1317 "Choose between the one frame, two frame, or basic calendar displays. 1320 "Choose between the one frame, two frame, or basic calendar displays.
1318If called with an optional prefix argument, prompts for month and year. 1321If called with an optional prefix argument ARG, prompts for month and year.
1319 1322
1320The original function `calendar' has been renamed `calendar-basic-setup'. 1323The original function `calendar' has been renamed `calendar-basic-setup'.
1321See the documentation of that function for more information." 1324See the documentation of that function for more information."
@@ -1344,7 +1347,7 @@ holidays are found, nil if not."
1344The three months appear side by side, with the current month in the middle 1347The three months appear side by side, with the current month in the middle
1345surrounded by the previous and next months. The cursor is put on today's date. 1348surrounded by the previous and next months. The cursor is put on today's date.
1346 1349
1347If called with an optional prefix argument, prompts for month and year. 1350If called with an optional prefix argument ARG, prompts for month and year.
1348 1351
1349This function is suitable for execution in a .emacs file; appropriate setting 1352This function is suitable for execution in a .emacs file; appropriate setting
1350of the variable `view-diary-entries-initially' will cause the diary entries for 1353of the variable `view-diary-entries-initially' will cause the diary entries for
@@ -1370,7 +1373,7 @@ The Gregorian calendar is assumed.
1370 1373
1371After loading the calendar, the hooks given by the variable 1374After loading the calendar, the hooks given by the variable
1372`calendar-load-hook' are run. This is the place to add key bindings to the 1375`calendar-load-hook' are run. This is the place to add key bindings to the
1373calendar-mode-map. 1376`calendar-mode-map'.
1374 1377
1375After preparing the calendar window initially, the hooks given by the variable 1378After preparing the calendar window initially, the hooks given by the variable
1376`initial-calendar-window-hook' are run. 1379`initial-calendar-window-hook' are run.
@@ -1521,13 +1524,13 @@ Or, for optional MON, YR."
1521 (if today-visible today (list displayed-month 1 displayed-year))) 1524 (if today-visible today (list displayed-month 1 displayed-year)))
1522 (set-buffer-modified-p nil) 1525 (set-buffer-modified-p nil)
1523 ;; Don't do any window-related stuff if we weren't called from a 1526 ;; Don't do any window-related stuff if we weren't called from a
1524 ;; window displaying the calendar 1527 ;; window displaying the calendar.
1525 (when in-calendar-window 1528 (when in-calendar-window
1526 (if (or (one-window-p t) (not (window-full-width-p))) 1529 (if (or (one-window-p t) (not (window-full-width-p)))
1527 ;; Don't mess with the window size, but ensure that the first 1530 ;; Don't mess with the window size, but ensure that the first
1528 ;; line is fully visible 1531 ;; line is fully visible.
1529 (set-window-vscroll nil 0) 1532 (set-window-vscroll nil 0)
1530 ;; Adjust the window to exactly fit the displayed calendar 1533 ;; Adjust the window to exactly fit the displayed calendar.
1531 (fit-window-to-buffer nil nil calendar-minimum-window-height)) 1534 (fit-window-to-buffer nil nil calendar-minimum-window-height))
1532 (sit-for 0)) 1535 (sit-for 0))
1533 (if (and (boundp 'font-lock-mode) 1536 (if (and (boundp 'font-lock-mode)
@@ -1565,7 +1568,7 @@ The calendar is inserted at the top of the buffer in which point is currently
1565located, but indented INDENT spaces. The indentation is done from the first 1568located, but indented INDENT spaces. The indentation is done from the first
1566character on the line and does not disturb the first INDENT characters on the 1569character on the line and does not disturb the first INDENT characters on the
1567line." 1570line."
1568 (let* ((blank-days;; at start of month 1571 (let* ((blank-days ; at start of month
1569 (mod 1572 (mod
1570 (- (calendar-day-of-week (list month 1 year)) 1573 (- (calendar-day-of-week (list month 1 year))
1571 calendar-week-start-day) 1574 calendar-week-start-day)
@@ -1576,7 +1579,7 @@ line."
1576 (calendar-string-spread 1579 (calendar-string-spread
1577 (list (format "%s %d" (calendar-month-name month) year)) ? 20) 1580 (list (format "%s %d" (calendar-month-name month) year)) ? 20)
1578 indent t) 1581 indent t)
1579 (calendar-insert-indented "" indent);; Go to proper spot 1582 (calendar-insert-indented "" indent) ; go to proper spot
1580 ;; Use the first two characters of each day to head the columns. 1583 ;; Use the first two characters of each day to head the columns.
1581 (dotimes (i 7) 1584 (dotimes (i 7)
1582 (insert 1585 (insert
@@ -1586,11 +1589,11 @@ line."
1586 (truncate-string-to-width string 2) 1589 (truncate-string-to-width string 2)
1587 (substring string 0 2))) 1590 (substring string 0 2)))
1588 " ")) 1591 " "))
1589 (calendar-insert-indented "" 0 t);; Force onto following line 1592 (calendar-insert-indented "" 0 t) ; force onto following line
1590 (calendar-insert-indented "" indent);; Go to proper spot 1593 (calendar-insert-indented "" indent) ; go to proper spot
1591 ;; Add blank days before the first of the month 1594 ;; Add blank days before the first of the month.
1592 (dotimes (idummy blank-days) (insert " ")) 1595 (dotimes (idummy blank-days) (insert " "))
1593 ;; Put in the days of the month 1596 ;; Put in the days of the month.
1594 (calendar-for-loop i from 1 to last do 1597 (calendar-for-loop i from 1 to last do
1595 (insert (format "%2d " i)) 1598 (insert (format "%2d " i))
1596 (add-text-properties 1599 (add-text-properties
@@ -1599,8 +1602,8 @@ line."
1599 help-echo "mouse-2: menu of operations for this date")) 1602 help-echo "mouse-2: menu of operations for this date"))
1600 (and (zerop (mod (+ i blank-days) 7)) 1603 (and (zerop (mod (+ i blank-days) 7))
1601 (/= i last) 1604 (/= i last)
1602 (calendar-insert-indented "" 0 t) ;; Force onto following line 1605 (calendar-insert-indented "" 0 t) ; force onto following line
1603 (calendar-insert-indented "" indent)))));; Go to proper spot 1606 (calendar-insert-indented "" indent))))) ; go to proper spot
1604 1607
1605(defun calendar-insert-indented (string indent &optional newline) 1608(defun calendar-insert-indented (string indent &optional newline)
1606 "Insert STRING at column INDENT. 1609 "Insert STRING at column INDENT.
@@ -1773,7 +1776,8 @@ the inserted text. Returns t."
1773 (define-key map [down-mouse-2] 1776 (define-key map [down-mouse-2]
1774 (easy-menu-binding cal-menu-global-mouse-menu)) 1777 (easy-menu-binding cal-menu-global-mouse-menu))
1775 1778
1776 map)) 1779 map)
1780 "Keymap for `calendar-mode'.")
1777 1781
1778(defun describe-calendar-mode () 1782(defun describe-calendar-mode ()
1779 "Create a help buffer with a brief description of the `calendar-mode'." 1783 "Create a help buffer with a brief description of the `calendar-mode'."
@@ -1791,7 +1795,8 @@ the inserted text. Returns t."
1791;; Calendar mode is suitable only for specially formatted data. 1795;; Calendar mode is suitable only for specially formatted data.
1792(put 'calendar-mode 'mode-class 'special) 1796(put 'calendar-mode 'mode-class 'special)
1793 1797
1794(defvar calendar-mode-line-format 1798;; After calendar-mode-map.
1799(defcustom calendar-mode-line-format
1795 (list 1800 (list
1796 (propertize "<" 1801 (propertize "<"
1797 'help-echo "mouse-1: previous month" 1802 'help-echo "mouse-1: previous month"
@@ -1835,7 +1840,7 @@ evaluated and concatenated together, evenly separated by blanks. The variable
1835defaults to the current date if it is otherwise undefined. Here is an example 1840defaults to the current date if it is otherwise undefined. Here is an example
1836value that has the Hebrew date, the day number/days remaining in the year, 1841value that has the Hebrew date, the day number/days remaining in the year,
1837and the ISO week/year numbers in the mode. When `calendar-move-hook' is set 1842and the ISO week/year numbers in the mode. When `calendar-move-hook' is set
1838to `update-calendar-mode-line', these mode line shows these values for the date 1843to `update-calendar-mode-line', the mode line shows these values for the date
1839under the cursor: 1844under the cursor:
1840 1845
1841 (list 1846 (list
@@ -1851,7 +1856,9 @@ under the cursor:
1851 (format \"ISO week %d of %d\" 1856 (format \"ISO week %d of %d\"
1852 (extract-calendar-month iso-date) 1857 (extract-calendar-month iso-date)
1853 (extract-calendar-year iso-date))) 1858 (extract-calendar-year iso-date)))
1854 \"\"))") 1859 \"\"))"
1860 :type 'sexp
1861 :group 'calendar)
1855 1862
1856(defun mouse-calendar-other-month (event) 1863(defun mouse-calendar-other-month (event)
1857 "Display a three-month calendar centered around a specified month and year." 1864 "Display a three-month calendar centered around a specified month and year."
@@ -1887,8 +1894,8 @@ For a complete description, type \
1887 (update-calendar-mode-line) 1894 (update-calendar-mode-line)
1888 (make-local-variable 'calendar-mark-ring) 1895 (make-local-variable 'calendar-mark-ring)
1889 (make-local-variable 'calendar-starred-day) 1896 (make-local-variable 'calendar-starred-day)
1890 (make-local-variable 'displayed-month) ;; Month in middle of window. 1897 (make-local-variable 'displayed-month) ; month in middle of window
1891 (make-local-variable 'displayed-year) ;; Year in middle of window. 1898 (make-local-variable 'displayed-year) ; year in middle of window
1892 ;; Most functions only work if displayed-month and displayed-year are set, 1899 ;; Most functions only work if displayed-month and displayed-year are set,
1893 ;; so let's make sure they're always set. Most likely, this will be reset 1900 ;; so let's make sure they're always set. Most likely, this will be reset
1894 ;; soon in generate-calendar, but better safe than sorry. 1901 ;; soon in generate-calendar, but better safe than sorry.
@@ -1906,7 +1913,7 @@ actually be an expression that evaluates to a string. If LENGTH is too short,
1906the STRINGS are just concatenated and the result truncated." 1913the STRINGS are just concatenated and the result truncated."
1907;; The algorithm is based on equation (3.25) on page 85 of Concrete 1914;; The algorithm is based on equation (3.25) on page 85 of Concrete
1908;; Mathematics by Ronald L. Graham, Donald E. Knuth, and Oren Patashnik, 1915;; Mathematics by Ronald L. Graham, Donald E. Knuth, and Oren Patashnik,
1909;; Addison-Wesley, Reading, MA, 1989 1916;; Addison-Wesley, Reading, MA, 1989.
1910 (let* ((strings (mapcar 'eval 1917 (let* ((strings (mapcar 'eval
1911 (if (< (length strings) 2) 1918 (if (< (length strings) 2)
1912 (append (list "") strings (list "")) 1919 (append (list "") strings (list ""))
@@ -1969,7 +1976,7 @@ the STRINGS are just concatenated and the result truncated."
1969 (yes-or-no-p 1976 (yes-or-no-p
1970 "Diary modified; do you really want to exit the calendar? ")) 1977 "Diary modified; do you really want to exit the calendar? "))
1971 ;; Need to do this multiple times because one time can replace some 1978 ;; Need to do this multiple times because one time can replace some
1972 ;; calendar-related buffers with other calendar-related buffers 1979 ;; calendar-related buffers with other calendar-related buffers.
1973 (mapc (lambda (x) 1980 (mapc (lambda (x)
1974 (mapc 'calendar-hide-window (calendar-window-list))) 1981 (mapc 'calendar-hide-window (calendar-window-list)))
1975 (calendar-window-list))))) 1982 (calendar-window-list)))))
@@ -2034,19 +2041,19 @@ ERROR is t, otherwise just returns nil."
2034;; "Compute the list (month day year) corresponding to the absolute DATE. 2041;; "Compute the list (month day year) corresponding to the absolute DATE.
2035;;The absolute date is the number of days elapsed since the (imaginary) 2042;;The absolute date is the number of days elapsed since the (imaginary)
2036;;Gregorian date Sunday, December 31, 1 BC." 2043;;Gregorian date Sunday, December 31, 1 BC."
2037;; (let* ((approx (/ date 366));; Approximation from below. 2044;; (let* ((approx (/ date 366)) ; approximation from below
2038;; (year ;; Search forward from the approximation. 2045;; (year ; search forward from the approximation
2039;; (+ approx 2046;; (+ approx
2040;; (calendar-sum y approx 2047;; (calendar-sum y approx
2041;; (>= date (calendar-absolute-from-gregorian (list 1 1 (1+ y)))) 2048;; (>= date (calendar-absolute-from-gregorian (list 1 1 (1+ y))))
2042;; 1))) 2049;; 1)))
2043;; (month ;; Search forward from January. 2050;; (month ; search forward from January
2044;; (1+ (calendar-sum m 1 2051;; (1+ (calendar-sum m 1
2045;; (> date 2052;; (> date
2046;; (calendar-absolute-from-gregorian 2053;; (calendar-absolute-from-gregorian
2047;; (list m (calendar-last-day-of-month m year) year))) 2054;; (list m (calendar-last-day-of-month m year) year)))
2048;; 1))) 2055;; 1)))
2049;; (day ;; Calculate the day by subtraction. 2056;; (day ; calculate the day by subtraction
2050;; (- date 2057;; (- date
2051;; (1- (calendar-absolute-from-gregorian (list month 1 year)))))) 2058;; (1- (calendar-absolute-from-gregorian (list month 1 year))))))
2052;; (list month day year))) 2059;; (list month day year)))
@@ -2056,10 +2063,10 @@ ERROR is t, otherwise just returns nil."
2056The absolute date is the number of days elapsed since the (imaginary) 2063The absolute date is the number of days elapsed since the (imaginary)
2057Gregorian date Sunday, December 31, 1 BC. This function does not 2064Gregorian date Sunday, December 31, 1 BC. This function does not
2058handle dates in years BC." 2065handle dates in years BC."
2059;; See the footnote on page 384 of ``Calendrical Calculations, Part II: 2066 ;; See the footnote on page 384 of ``Calendrical Calculations, Part II:
2060;; Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M. 2067 ;; Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
2061;; Clamen, Software--Practice and Experience, Volume 23, Number 4 2068 ;; Clamen, Software--Practice and Experience, Volume 23, Number 4
2062;; (April, 1993), pages 383-404 for an explanation. 2069 ;; (April, 1993), pages 383-404 for an explanation.
2063 (let* ((d0 (1- date)) 2070 (let* ((d0 (1- date))
2064 (n400 (/ d0 146097)) 2071 (n400 (/ d0 146097))
2065 (d1 (% d0 146097)) 2072 (d1 (% d0 146097))
@@ -2098,7 +2105,7 @@ handle dates in years BC."
2098(defun calendar-set-mark (arg) 2105(defun calendar-set-mark (arg)
2099 "Mark the date under the cursor, or jump to marked date. 2106 "Mark the date under the cursor, or jump to marked date.
2100With no prefix argument, push current date onto marked date ring. 2107With no prefix argument, push current date onto marked date ring.
2101With argument, jump to mark, pop it, and put point at end of ring." 2108With argument ARG, jump to mark, pop it, and put point at end of ring."
2102 (interactive "P") 2109 (interactive "P")
2103 (let ((date (calendar-cursor-to-date t))) 2110 (let ((date (calendar-cursor-to-date t)))
2104 (if (null arg) 2111 (if (null arg)
@@ -2257,10 +2264,11 @@ each element returned has a final `.' character."
2257 (,(regexp-opt 2264 (,(regexp-opt
2258 (list (substring (aref calendar-day-name-array 6) 0 2) 2265 (list (substring (aref calendar-day-name-array 6) 0 2)
2259 (substring (aref calendar-day-name-array 0) 0 2))) 2266 (substring (aref calendar-day-name-array 0) 0 2)))
2260 ;; Saturdays and Sundays are hilited differently. 2267 ;; Saturdays and Sundays are highlighted differently.
2261 . font-lock-comment-face) 2268 . font-lock-comment-face)
2262 ;; First two chars of each day are used in the calendar. 2269 ;; First two chars of each day are used in the calendar.
2263 (,(regexp-opt (mapcar (lambda (x) (substring x 0 2)) calendar-day-name-array)) 2270 (,(regexp-opt (mapcar (lambda (x) (substring x 0 2))
2271 calendar-day-name-array))
2264 . font-lock-reference-face)) 2272 . font-lock-reference-face))
2265 "Default keywords to highlight in Calendar mode.") 2273 "Default keywords to highlight in Calendar mode.")
2266 2274
@@ -2379,11 +2387,11 @@ MARK defaults to `diary-entry-marker'."
2379 (and (facep mark) mark) ; face-name 2387 (and (facep mark) mark) ; face-name
2380 diary-entry-marker)) 2388 diary-entry-marker))
2381 (cond 2389 (cond
2382 ;; face or an attr-list that contained a face 2390 ;; Face or an attr-list that contained a face.
2383 ((facep mark) 2391 ((facep mark)
2384 (overlay-put 2392 (overlay-put
2385 (make-overlay (1- (point)) (1+ (point))) 'face mark)) 2393 (make-overlay (1- (point)) (1+ (point))) 'face mark))
2386 ;; single-char 2394 ;; Single-character.
2387 ((and (stringp mark) (= (length mark) 1)) 2395 ((and (stringp mark) (= (length mark) 1))
2388 (let ((inhibit-read-only t)) 2396 (let ((inhibit-read-only t))
2389 (forward-char 1) 2397 (forward-char 1)
@@ -2391,7 +2399,7 @@ MARK defaults to `diary-entry-marker'."
2391 (insert mark) 2399 (insert mark)
2392 (delete-char 1) 2400 (delete-char 1)
2393 (forward-char -2))) 2401 (forward-char -2)))
2394 (t ;; attr list 2402 (t ; attr list
2395 (let ((temp-face 2403 (let ((temp-face
2396 (make-symbol 2404 (make-symbol
2397 (apply 'concat "temp-" 2405 (apply 'concat "temp-"
@@ -2403,14 +2411,13 @@ MARK defaults to `diary-entry-marker'."
2403 mark)))) 2411 mark))))
2404 (faceinfo mark)) 2412 (faceinfo mark))
2405 (make-face temp-face) 2413 (make-face temp-face)
2406 ;; Remove :face info from the mark, copy the face info into 2414 ;; Remove :face info from mark, copy the face info into temp-face.
2407 ;; temp-face
2408 (while (setq faceinfo (memq :face faceinfo)) 2415 (while (setq faceinfo (memq :face faceinfo))
2409 (copy-face (read (nth 1 faceinfo)) temp-face) 2416 (copy-face (read (nth 1 faceinfo)) temp-face)
2410 (setcar faceinfo nil) 2417 (setcar faceinfo nil)
2411 (setcar (cdr faceinfo) nil)) 2418 (setcar (cdr faceinfo) nil))
2412 (setq mark (delq nil mark)) 2419 (setq mark (delq nil mark))
2413 ;; Apply the font aspects 2420 ;; Apply the font aspects.
2414 (apply 'set-face-attribute temp-face nil mark) 2421 (apply 'set-face-attribute temp-face nil mark)
2415 (overlay-put 2422 (overlay-put
2416 (make-overlay (1- (point)) (1+ (point))) 'face temp-face)))))))) 2423 (make-overlay (1- (point)) (1+ (point))) 'face temp-face))))))))
@@ -2586,6 +2593,7 @@ Defaults to today's date if DATE is not given."
2586 2593
2587 2594
2588(defun calendar-version () 2595(defun calendar-version ()
2596 "Display the Calendar version."
2589 (interactive) 2597 (interactive)
2590 (message "GNU Emacs %s" emacs-version)) 2598 (message "GNU Emacs %s" emacs-version))
2591 2599