org-agenda.el (org-agenda-quit): Delete indirect buffer's window only when it exists
authorMuchenxuan Tong <demon386@gmail.com>
Tue, 22 Jan 2013 13:14:08 +0000 (22 14:14 +0100)
committerBastien Guerry <bzg@altern.org>
Tue, 22 Jan 2013 13:14:08 +0000 (22 14:14 +0100)
* org-agenda.el (org-agenda-quit): Delete indirect buffer's window
only when it exists.

When indirect buffer's window doesn't exist, the original logic will
delete the current window.

TINYCHANGE

lisp/org-agenda.el

index cefdc0e..5e11358 100644 (file)
@@ -6893,7 +6893,10 @@ Allowed types are 'agenda 'timeline 'todo 'tags 'search."
   (interactive)
   (if (and (eq org-indirect-buffer-display 'other-window)
           org-last-indirect-buffer)
-      (delete-window (get-buffer-window org-last-indirect-buffer)))
+      (let ((org-last-indirect-window
+            (get-buffer-window org-last-indirect-buffer)))
+       (if org-last-indirect-window
+           (delete-window org-last-indirect-window))))
   (if org-agenda-columns-active
       (org-columns-quit)
     (if org-agenda-sticky