changeset 60322:ae2850fc74dc

(redraw-calendar): Work from any buffer, not just the calendar.
author Glenn Morris <rgm@gnu.org>
date Tue, 01 Mar 2005 10:24:33 +0000
parents efcf9ada3122
children db96e0c27e1b
files lisp/calendar/calendar.el
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calendar/calendar.el	Tue Mar 01 10:23:58 2005 +0000
+++ b/lisp/calendar/calendar.el	Tue Mar 01 10:24:33 2005 +0000
@@ -2169,11 +2169,13 @@
   t)
 
 (defun redraw-calendar ()
-  "Redraw the calendar display."
+  "Redraw the calendar display, if `calendar-buffer' is live."
   (interactive)
-  (let ((cursor-date (calendar-cursor-to-nearest-date)))
-    (generate-calendar-window displayed-month displayed-year)
-    (calendar-cursor-to-visible-date cursor-date)))
+  (if (get-buffer calendar-buffer)
+      (with-current-buffer calendar-buffer
+        (let ((cursor-date (calendar-cursor-to-nearest-date)))
+          (generate-calendar-window displayed-month displayed-year)
+          (calendar-cursor-to-visible-date cursor-date)))))
 
 (defcustom calendar-debug-sexp nil
   "*Turn debugging on when evaluating a sexp in the diary or holiday list."