summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-05-04 16:02:44 +0000
committerRichard M. Stallman <rms@gnu.org>1997-05-04 16:02:44 +0000
commite5b084645ddd8c8fb9f6a9b0f07f7f75e85db6de (patch)
treea3d5909bfd2503c8d130a2b09b22e72cb0160877
parent381b7500eff1d4913ec036e3c75ef3ac55a21881 (diff)
downloademacs-e5b084645ddd8c8fb9f6a9b0f07f7f75e85db6de.tar.gz
(list-holidays): Fix buffer title when list is
nil. Do save-excursion to keep from messing up calendar variables. Handle CHOICE = "" like CHOICE = "Ask".
-rw-r--r--lisp/calendar/holidays.el41
1 files changed, 22 insertions, 19 deletions
diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el
index 65cef292794..e7077e96ecf 100644
--- a/lisp/calendar/holidays.el
+++ b/lisp/calendar/holidays.el
@@ -143,14 +143,14 @@ The optional LABEL is used to label the buffer created."
(cdr (assoc choice lists))))
(name (if (string-equal choice "Equinoxes/Solstices")
choice
- (if (string-equal choice "Ask")
+ (if (member choice '("Ask" ""))
"Holidays"
(format "%s Holidays" choice)))))
(list start-year end-year which name)))
(message "Computing holidays...")
(let* ((holiday-buffer "*Holidays*")
(calendar-holidays (if l l calendar-holidays))
- (title (if label label "Holidays"))
+ (title (or label "Holidays"))
(holiday-list nil)
(s (calendar-absolute-from-gregorian (list 2 1 y1)))
(e (calendar-absolute-from-gregorian (list 11 1 y2)))
@@ -164,23 +164,26 @@ The optional LABEL is used to label the buffer created."
(increment-calendar-month displayed-month displayed-year 3)
(setq d (calendar-absolute-from-gregorian
(list displayed-month 1 displayed-year))))
- (set-buffer (get-buffer-create holiday-buffer))
- (setq buffer-read-only nil)
- (calendar-set-mode-line
- (if (= y1 y2)
- (format "%s for %s" label y1)
- (format "%s for %s-%s" label y1 y2)))
- (erase-buffer)
- (goto-char (point-min))
- (insert
- (mapconcat
- '(lambda (x) (concat (calendar-date-string (car x)) ": " (car (cdr x))))
- holiday-list "\n"))
- (goto-char (point-min))
- (set-buffer-modified-p nil)
- (setq buffer-read-only t)
- (display-buffer holiday-buffer)
- (message "Computing holidays...done")))
+ (save-excursion
+ (set-buffer (get-buffer-create holiday-buffer))
+ (setq buffer-read-only nil)
+ (calendar-set-mode-line
+ (if (= y1 y2)
+ (format "%s for %s" title y1)
+ (format "%s for %s-%s" title y1 y2)))
+ (erase-buffer)
+ (goto-char (point-min))
+ (insert
+ (mapconcat
+ '(lambda (x) (concat (calendar-date-string (car x))
+ ": " (car (cdr x))))
+ holiday-list "\n"))
+ (goto-char (point-min))
+ (set-buffer-modified-p nil)
+ (setq buffer-read-only t)
+ (display-buffer holiday-buffer)
+ (message "Computing holidays...done"))))
+
(defun check-calendar-holidays (date)
"Check the list of holidays for any that occur on DATE.