diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2010-09-23 15:00:31 -0400 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2010-09-23 15:00:31 -0400 |
commit | 266a86bd7fedf743225c2497956b73ecb2245196 (patch) | |
tree | 7d0c8b128070eac293ce2606acb4e55de5843ba8 /lisp/calendar | |
parent | 29cdc13ed61e5a64ba30df1030029898a26b7947 (diff) | |
parent | af3ccb5cc061bccab1c9b024ea444d01c0767767 (diff) | |
download | emacs-266a86bd7fedf743225c2497956b73ecb2245196.tar.gz |
Merge changes from emacs-23 branch
Diffstat (limited to 'lisp/calendar')
-rw-r--r-- | lisp/calendar/appt.el | 71 | ||||
-rw-r--r-- | lisp/calendar/diary-lib.el | 16 | ||||
-rw-r--r-- | lisp/calendar/solar.el | 6 |
3 files changed, 64 insertions, 29 deletions
diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el index ea419aee52d..18f7a36012f 100644 --- a/lisp/calendar/appt.el +++ b/lisp/calendar/appt.el @@ -334,30 +334,42 @@ displayed in a window: (if (or force ; eg initialize, diary save (null appt-prev-comp-time) ; first check (< cur-comp-time appt-prev-comp-time)) ; new day - (condition-case nil - (if appt-display-diary - (let ((diary-hook - (if (assoc 'appt-make-list diary-hook) - diary-hook - (cons 'appt-make-list diary-hook)))) - (diary)) - (let* ((diary-display-function 'appt-make-list) - (d-buff (find-buffer-visiting diary-file)) - (selective - (if d-buff ; diary buffer exists - (with-current-buffer d-buff - diary-selective-display)))) - ;; FIXME why not using diary-list-entries with - ;; non-nil LIST-ONLY? - (diary) - ;; If the diary buffer existed before this command, - ;; restore its display state. Otherwise, kill it. - (if d-buff - ;; Displays the diary buffer. - (or selective (diary-show-all-entries)) - (and (setq d-buff (find-buffer-visiting diary-file)) - (kill-buffer d-buff))))) - (error nil))) + (ignore-errors + (if appt-display-diary + (let ((diary-hook + (if (assoc 'appt-make-list diary-hook) + diary-hook + (cons 'appt-make-list diary-hook)))) + (diary)) + (let* ((diary-display-function 'appt-make-list) + (d-buff (find-buffer-visiting diary-file)) + (selective + (if d-buff ; diary buffer exists + (with-current-buffer d-buff + diary-selective-display))) + d-buff2) + ;; Not displaying the diary, so we can ignore + ;; diary-number-of-entries. Since appt.el only + ;; works on a daily basis, no need for more entries. + ;; FIXME why not using diary-list-entries with + ;; non-nil LIST-ONLY? + (diary 1) + ;; If the diary buffer existed before this command, + ;; restore its display state. Otherwise, kill it. + (and (setq d-buff2 (find-buffer-visiting diary-file)) + (if d-buff + (or selective + (with-current-buffer d-buff2 + (if diary-selective-display + ;; diary-show-all-entries displays + ;; the diary buffer. + (diary-unhide-everything)))) + ;; FIXME does not kill any included diary files. + ;; The real issue is that (diary) should not + ;; have the side effect of visiting all the + ;; diary files. It is not really appt.el's job to + ;; clean up this mess... + (kill-buffer d-buff2))))))) (setq appt-prev-comp-time cur-comp-time appt-mode-string nil appt-display-count nil) @@ -573,6 +585,17 @@ appointment package (if it is not already active)." (let ((entry-list diary-entries-list) (new-time-string "") time-string) + ;; Below, we assume diary-entries-list was in date + ;; order. It is, unless something on + ;; diary-list-entries-hook has changed it, eg + ;; diary-include-other-files (bug#7019). It must be + ;; in date order if number = 1. + (and diary-list-entries-hook + appt-display-diary + (not (eq diary-number-of-entries 1)) + (not (memq (car (last diary-list-entries-hook)) + '(diary-sort-entries sort-diary-entries))) + (setq entry-list (sort entry-list 'diary-entry-compare))) ;; Skip diary entries for dates before today. (while (and entry-list (calendar-date-compare diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 46926050362..219e489a2eb 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el @@ -711,14 +711,26 @@ The arguments are DATE and NUMBER; the entries selected are those for NUMBER days starting with date DATE. The other entries are hidden using overlays. If NUMBER is less than 1, this function does nothing. -Returns a list of all relevant diary entries found, if any, in order by date. +Returns a list of all relevant diary entries found. The list entries have the form ((MONTH DAY YEAR) STRING SPECIFIER) where \(MONTH DAY YEAR) is the date of the entry, STRING is the entry text, and SPECIFIER is the applicability. If the variable `diary-list-include-blanks' is non-nil, this list includes a dummy diary entry consisting of the empty string for a date with no diary entries. -After the list is prepared, the following hooks are run: +If entries are being produced for multiple dates (i.e., NUMBER > 1), +then this function normally returns the entries from any given +diary file in date order. The entries for any given day are in +the order in which they were found in the file, not necessarily +in time-of-day order. Note that any functions present on the +hooks (see below) may add entries, or change the order. For +example, `diary-include-other-diary-files' adds entries from any +include files that it finds to the end of the original list. The +entries from each file will be in date order, but the overall +list will not be. If you want the entire list to be in time order, +add `diary-sort-entries' to the end of `diary-list-entries-hook'. + +After the initial list is prepared, the following hooks are run: `diary-nongregorian-listing-hook' can cull dates from the diary and each included file, for example to process Islamic diary diff --git a/lisp/calendar/solar.el b/lisp/calendar/solar.el index 8cf831f9945..b7a728461f0 100644 --- a/lisp/calendar/solar.el +++ b/lisp/calendar/solar.el @@ -753,12 +753,12 @@ The values of `calendar-daylight-savings-starts', (sin (mod (+ (cadr x) (* (nth 2 x) U)) - (* 2 pi))))) + (* 2 float-pi))))) solar-data-list))))) (aberration (* 0.0000001 (- (* 17 (cos (+ 3.10 (* 62830.14 U)))) 973))) - (A1 (mod (+ 2.18 (* U (+ -3375.70 (* 0.36 U)))) (* 2 pi))) - (A2 (mod (+ 3.51 (* U (+ 125666.39 (* 0.10 U)))) (* 2 pi))) + (A1 (mod (+ 2.18 (* U (+ -3375.70 (* 0.36 U)))) (* 2 float-pi))) + (A2 (mod (+ 3.51 (* U (+ 125666.39 (* 0.10 U)))) (* 2 float-pi))) (nutation (* -0.0000001 (+ (* 834 (sin A1)) (* 64 (sin A2)))))) (mod (radians-to-degrees (+ longitude aberration nutation)) 360.0))) |