aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2005-09-12 21:32:11 +0000
committerStefan Monnier2005-09-12 21:32:11 +0000
commit34cb01154aaa2b5a9803a56941f1074db326924c (patch)
treededd8e465658ccd65273eaa7e9595e3ba5bd2d58
parent01a7778ef4902c697e7578ae085a0ee3772b212a (diff)
downloademacs-34cb01154aaa2b5a9803a56941f1074db326924c.tar.gz
emacs-34cb01154aaa2b5a9803a56941f1074db326924c.zip
(calendar-for-loop): Add edebug info.
(calendar-basic-setup): Use the new nil arg. (number-of-diary-entries): Move to diary-lib.el.
-rw-r--r--lisp/ChangeLog24
-rw-r--r--lisp/calendar/calendar.el68
2 files changed, 42 insertions, 50 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f8717bc0ea5..ea8039d7c2f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -9,6 +9,30 @@
9 9
102005-09-12 Stefan Monnier <monnier@iro.umontreal.ca> 102005-09-12 Stefan Monnier <monnier@iro.umontreal.ca>
11 11
12 * calendar/calendar.el (calendar-for-loop): Add edebug info.
13 (calendar-basic-setup): Use the new nil arg.
14 (number-of-diary-entries): Move to diary-lib.el.
15
16 * calendar/diary-lib.el: Use with-current-buffer, match-string.
17 (diary-list-entries): Use with-syntax-table and dolist.
18 Rename from list-diary-entries.
19 Use number-of-diary-entries if `number' is nil.
20 (diary, diary-view-entries): Use this new name and new nil arg value.
21 (number-of-diary-entries): Move from calendar.el.
22 (diary-unhide-everything): New function.
23 (include-other-diary-files, fancy-diary-display)
24 (diary-show-all-entries, make-diary-entry): Use it.
25 (diary-mail-entries): Use buffer-string.
26 (mark-diary-entries): Fix long standing paren typo.
27 (diary-sexp-entry): Use count-lines.
28 (make-diary-entry): Avoid `previous-line'.
29 (diary-mode-map): New var.
30 (diary-mode): Redraw cal after saving. Setup header-line.
31 (fancy-diary-display-mode): Use local-set-key.
32
33 * startup.el (command-line): Try calling various terminal-init-foo-bar
34 functions by stripping hyphenated suffixes from $TERM.
35
12 * files.el (normal-mode): Check boundness of font-lock-keywords. 36 * files.el (normal-mode): Check boundness of font-lock-keywords.
13 37
142005-09-12 Richard M. Stallman <rms@gnu.org> 382005-09-12 Richard M. Stallman <rms@gnu.org>
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 3e075b9d6bd..2d2e5256977 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -164,35 +164,6 @@ be overridden by the value of `calendar-setup'."
164 :group 'diary) 164 :group 'diary)
165 165
166;;;###autoload 166;;;###autoload
167(defcustom number-of-diary-entries 1
168 "*Specifies how many days of diary entries are to be displayed initially.
169This variable affects the diary display when the command \\[diary] is used,
170or if the value of the variable `view-diary-entries-initially' is t. For
171example, if the default value 1 is used, then only the current day's diary
172entries will be displayed. If the value 2 is used, then both the current
173day's and the next day's entries will be displayed.
174
175The value can also be a vector such as [0 2 2 2 2 4 1]; this value
176says to display no diary entries on Sunday, the display the entries
177for the current date and the day after on Monday through Thursday,
178display Friday through Monday's entries on Friday, and display only
179Saturday's entries on Saturday.
180
181This variable does not affect the diary display with the `d' command
182from the calendar; in that case, the prefix argument controls the
183number of days of diary entries displayed."
184 :type '(choice (integer :tag "Entries")
185 (vector :value [0 0 0 0 0 0 0]
186 (integer :tag "Sunday")
187 (integer :tag "Monday")
188 (integer :tag "Tuesday")
189 (integer :tag "Wednesday")
190 (integer :tag "Thursday")
191 (integer :tag "Friday")
192 (integer :tag "Saturday")))
193 :group 'diary)
194
195;;;###autoload
196(defcustom mark-diary-entries-in-calendar nil 167(defcustom mark-diary-entries-in-calendar nil
197 "*Non-nil means mark dates with diary entries, in the calendar window. 168 "*Non-nil means mark dates with diary entries, in the calendar window.
198The marking symbol is specified by the variable `diary-entry-marker'." 169The marking symbol is specified by the variable `diary-entry-marker'."
@@ -393,7 +364,7 @@ functions that move by days and weeks."
393 364
394For example, 365For example,
395 366
396 (add-hook 'calendar-move-hook (lambda () (view-diary-entries 1))) 367 (add-hook 'calendar-move-hook (lambda () (diary-view-entries 1)))
397 368
398redisplays the diary for whatever date the cursor is moved to." 369redisplays the diary for whatever date the cursor is moved to."
399 :type 'hook 370 :type 'hook
@@ -1335,6 +1306,7 @@ A negative YR is interpreted as BC; -1 being 1 BC, and so on."
1335 1306
1336(defmacro calendar-for-loop (var from init to final do &rest body) 1307(defmacro calendar-for-loop (var from init to final do &rest body)
1337 "Execute a for loop." 1308 "Execute a for loop."
1309 (declare (debug (symbolp "from" form "to" form "do" body)))
1338 `(let ((,var (1- ,init))) 1310 `(let ((,var (1- ,init)))
1339 (while (>= ,final (setq ,var (1+ ,var))) 1311 (while (>= ,final (setq ,var (1+ ,var)))
1340 ,@body))) 1312 ,@body)))
@@ -1651,10 +1623,7 @@ to be replaced by asterisks to highlight it whenever it is in the window."
1651 (increment-calendar-month month year (- calendar-offset)) 1623 (increment-calendar-month month year (- calendar-offset))
1652 (generate-calendar-window month year) 1624 (generate-calendar-window month year)
1653 (if (and view-diary-entries-initially (calendar-date-is-visible-p date)) 1625 (if (and view-diary-entries-initially (calendar-date-is-visible-p date))
1654 (view-diary-entries 1626 (diary-view-entries)))
1655 (if (vectorp number-of-diary-entries)
1656 (aref number-of-diary-entries (calendar-day-of-week date))
1657 number-of-diary-entries))))
1658 (let* ((diary-buffer (get-file-buffer diary-file)) 1627 (let* ((diary-buffer (get-file-buffer diary-file))
1659 (diary-window (if diary-buffer (get-buffer-window diary-buffer))) 1628 (diary-window (if diary-buffer (get-buffer-window diary-buffer)))
1660 (split-height-threshold (if diary-window 2 1000))) 1629 (split-height-threshold (if diary-window 2 1000)))
@@ -1662,7 +1631,7 @@ to be replaced by asterisks to highlight it whenever it is in the window."
1662 (list-calendar-holidays))) 1631 (list-calendar-holidays)))
1663 (run-hooks 'initial-calendar-window-hook)) 1632 (run-hooks 'initial-calendar-window-hook))
1664 1633
1665(autoload 'view-diary-entries "diary-lib" 1634(autoload 'diary-view-entries "diary-lib"
1666 "Prepare and display a buffer with diary entries. 1635 "Prepare and display a buffer with diary entries.
1667Searches your diary file for entries that match ARG days starting with 1636Searches your diary file for entries that match ARG days starting with
1668the date indicated by the cursor position in the displayed three-month 1637the date indicated by the cursor position in the displayed three-month
@@ -2272,7 +2241,7 @@ movement commands will not work correctly."
2272 (define-key calendar-mode-map "x" 'mark-calendar-holidays) 2241 (define-key calendar-mode-map "x" 'mark-calendar-holidays)
2273 (define-key calendar-mode-map "u" 'calendar-unmark) 2242 (define-key calendar-mode-map "u" 'calendar-unmark)
2274 (define-key calendar-mode-map "m" 'mark-diary-entries) 2243 (define-key calendar-mode-map "m" 'mark-diary-entries)
2275 (define-key calendar-mode-map "d" 'view-diary-entries) 2244 (define-key calendar-mode-map "d" 'diary-view-entries)
2276 (define-key calendar-mode-map "D" 'view-other-diary-entries) 2245 (define-key calendar-mode-map "D" 'view-other-diary-entries)
2277 (define-key calendar-mode-map "s" 'show-all-diary-entries) 2246 (define-key calendar-mode-map "s" 'show-all-diary-entries)
2278 (define-key calendar-mode-map "pd" 'calendar-print-day-of-year) 2247 (define-key calendar-mode-map "pd" 'calendar-print-day-of-year)
@@ -2493,8 +2462,7 @@ the STRINGS are just concatenated and the result truncated."
2493(defun update-calendar-mode-line () 2462(defun update-calendar-mode-line ()
2494 "Update the calendar mode line with the current date and date style." 2463 "Update the calendar mode line with the current date and date style."
2495 (if (bufferp (get-buffer calendar-buffer)) 2464 (if (bufferp (get-buffer calendar-buffer))
2496 (save-excursion 2465 (with-current-buffer calendar-buffer
2497 (set-buffer calendar-buffer)
2498 (setq mode-line-format 2466 (setq mode-line-format
2499 (calendar-string-spread 2467 (calendar-string-spread
2500 (let ((date (condition-case nil 2468 (let ((date (condition-case nil
@@ -2589,14 +2557,15 @@ ERROR is t, otherwise just returns nil."
2589 (list month 2557 (list month
2590 (string-to-number (buffer-substring (1+ (point)) (+ 4 (point)))) 2558 (string-to-number (buffer-substring (1+ (point)) (+ 4 (point))))
2591 year)) 2559 year))
2592 (if (looking-at "\\*") 2560 (if (and (looking-at "\\*")
2593 (save-excursion 2561 (save-excursion
2594 (re-search-backward "[^*]") 2562 (re-search-backward "[^*]")
2595 (if (looking-at ".\\*\\*") 2563 (looking-at ".\\*\\*")))
2596 (list month calendar-starred-day year) 2564 (list month calendar-starred-day year)
2597 (if error (error "Not on a date!"))))
2598 (if error (error "Not on a date!")))))) 2565 (if error (error "Not on a date!"))))))
2599 2566
2567(add-to-list 'debug-ignored-errors "Not on a date!")
2568
2600;; The following version of calendar-gregorian-from-absolute is preferred for 2569;; The following version of calendar-gregorian-from-absolute is preferred for
2601;; reasons of clarity, BUT it's much slower than the version that follows it. 2570;; reasons of clarity, BUT it's much slower than the version that follows it.
2602 2571
@@ -3071,8 +3040,7 @@ Defaults to today's date if DATE is not given."
3071 "Show dates on other calendars for date under the cursor." 3040 "Show dates on other calendars for date under the cursor."
3072 (interactive) 3041 (interactive)
3073 (let* ((date (calendar-cursor-to-date t))) 3042 (let* ((date (calendar-cursor-to-date t)))
3074 (save-excursion 3043 (with-current-buffer (get-buffer-create other-calendars-buffer)
3075 (set-buffer (get-buffer-create other-calendars-buffer))
3076 (setq buffer-read-only nil) 3044 (setq buffer-read-only nil)
3077 (calendar-set-mode-line 3045 (calendar-set-mode-line
3078 (concat (calendar-date-string date) " (Gregorian)")) 3046 (concat (calendar-date-string date) " (Gregorian)"))
@@ -3138,9 +3106,9 @@ Defaults to today's date if DATE is not given."
3138 3106
3139(provide 'calendar) 3107(provide 'calendar)
3140 3108
3141;;; Local variables: 3109;; Local variables:
3142;;; byte-compile-dynamic: t 3110;; byte-compile-dynamic: t
3143;;; End: 3111;; End:
3144 3112
3145;;; arch-tag: 19c61596-c8fb-4c69-bcf1-7dd739919cd8 3113;; arch-tag: 19c61596-c8fb-4c69-bcf1-7dd739919cd8
3146;;; calendar.el ends here 3114;;; calendar.el ends here