0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-22 17:18:35 +00:00

Use `with-selected-window' to select calendar window

* org.el (org-recenter-calendar): Use `with-selected-window' to select
calendar window and save currently selected window and current buffer.

Fixes a bug reported by Thomas Morgan in <mid:87obsxwpvc.fsf@ziiuu.com>.
This commit is contained in:
David Maus 2012-02-18 11:21:05 +01:00
parent 5fa426bfe2
commit eed72c5556

View file

@ -16178,14 +16178,12 @@ in the timestamp determines what will be changed."
(defun org-recenter-calendar (date)
"If the calendar is visible, recenter it to DATE."
(let* ((win (selected-window))
(cwin (get-buffer-window "*Calendar*" t))
(calendar-move-hook nil))
(let ((cwin (get-buffer-window "*Calendar*" t)))
(when cwin
(select-window cwin)
(calendar-goto-date (if (listp date) date
(calendar-gregorian-from-absolute date)))
(select-window win))))
(let ((calendar-move-hook nil))
(with-selected-window cwin
(calendar-goto-date (if (listp date) date
(calendar-gregorian-from-absolute date))))))))
(defun org-goto-calendar (&optional arg)
"Go to the Emacs calendar at the current date.