For example, I often move to a future date and `i d' to insert a reminder in the diary file and then C-x C-s. When I switch back to calendar for further work, point is at the inconvenient point-min. The proposed fix is in the patch attached. I'd bet there are more occurrences in emacs source that fall into this trap. Leo diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 9b0eb3e9..74d3ce80 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -1562,11 +1562,13 @@ (defun calendar-generate-month (month year indent) (defun calendar-redraw () "Redraw the calendar display, if `calendar-buffer' is live." (interactive) - (if (get-buffer calendar-buffer) - (with-current-buffer calendar-buffer - (let ((cursor-date (calendar-cursor-to-nearest-date))) - (calendar-generate-window displayed-month displayed-year) - (calendar-cursor-to-visible-date cursor-date))))) + (when (get-buffer calendar-buffer) + (with-current-buffer calendar-buffer + (let ((cursor-date (calendar-cursor-to-nearest-date))) + (calendar-generate-window displayed-month displayed-year) + (calendar-cursor-to-visible-date cursor-date)) + (when (window-live-p (get-buffer-window)) + (set-window-point (get-buffer-window) (point)))))) (defvar calendar-mode-map (let ((map (make-keymap)))