org-agenda: Fix issues with restoring windows
commit7e945107ced488344fd78cd1388cf000b29733e8
authorKyle Meyer <kyle@kyleam.com>
Mon, 5 Jan 2015 03:18:46 +0000 (4 22:18 -0500)
committerNicolas Goaziou <mail@nicolasgoaziou.fr>
Mon, 5 Jan 2015 11:49:44 +0000 (5 12:49 +0100)
tree4cca515b9726de6c41a6519afd994f310b6fa296
parent460f31efa03ceb18c8177dd1da76ae9d8650e0aa
org-agenda: Fix issues with restoring windows

* lisp/org-agenda.el (org-agenda-prepare-window): Update window
  configuration even when agenda buffer exists in background.
* lisp/org-agenda.el (org-agenda-Quit): Use buffer value for
  org-agenda-pre-window-conf to allow for local values used with sticky
  agenda buffers.
* lisp/org-agenda.el (org-agenda-quit): Reset local, not global, value for
  org-agenda-pre-window-conf.
* lisp/org-agenda.el (org-agenda--quit): New function.

Update the pre-agenda window configuration on the next agenda call even
if org-agenda-pre-window-conf is non-nil (which occurs when the agenda
buffer is exited without q, Q, or X).  This prevents restoring a window
configuration that is not the one prior to the most recent agenda call.

Make org-agenda-Quit (Q) restore the buffer-local, not the global, value
for org-agenda-pre-window-conf so that it works correctly with sticky
agenda buffers.

Along with these changes, merge the duplicated functionality of
org-agenda-quit and org-agenda-Quit into a new function,
org-agenda--quit.
lisp/org-agenda.el