org-agenda.el (org-agenda-todo): Restore the window correctly

* org-agenda.el (org-agenda-todo): Always restore the window
state after `org-agenda-change-all-lines' has been called.

`org-agenda-change-all-lines' is narrowing to the line it needs to
update.  In the narrowed state, `org-agenda-finalize' is called,
which may lead to a change in the way the window is displayed.  We
use `save-window-excursion' to ensure the window state is restored
correctly.

Thanks to Francesco Pizzolante for reporting this with a
detailed recipe.
This commit is contained in:
Bastien Guerry 2014-03-18 20:54:02 +01:00
parent c16e09e158
commit 6ba3b2d03d
1 changed files with 1 additions and 1 deletions

View File

@ -8792,7 +8792,7 @@ the same tree node, and the headline of the tree node in the Org-mode file."
(org-back-to-heading)
(move-marker org-last-heading-marker (point))))
(beginning-of-line 1)
(save-excursion
(save-window-excursion
(org-agenda-change-all-lines newhead hdmarker 'fixface just-one))
(when (org-bound-and-true-p org-clock-out-when-done)
(string-match (concat "^" (regexp-opt org-done-keywords-for-agenda))