From c5128d1666e5fbe29a2fdfd6ee51622f05c42e9b Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Fri, 17 Feb 2012 22:44:13 -1000 Subject: [PATCH] Fix behavior of org-agenda-tree-to-indirect-buffer --- lisp/org-agenda.el | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 780794e..0c32b48 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -7202,16 +7202,19 @@ use the dedicated frame)." (if (and current-prefix-arg (listp current-prefix-arg)) (org-agenda-do-tree-to-indirect-buffer) (let ((agenda-window (selected-window)) - (indirect-window (get-buffer-window org-last-indirect-buffer))) + (indirect-window + (and org-last-indirect-buffer + (get-buffer-window org-last-indirect-buffer)))) (save-window-excursion (org-agenda-do-tree-to-indirect-buffer)) (unwind-protect - (progn - (unless indirect-window + (progn + (unless (and indirect-window (window-live-p indirect-window)) (setq indirect-window (split-window agenda-window))) (select-window indirect-window) (switch-to-buffer org-last-indirect-buffer :norecord) + (org-set-visibility-according-to-property) (fit-window-to-buffer indirect-window)) - (select-window agenda-window))))) + (select-window agenda-window))))) (defun org-agenda-do-tree-to-indirect-buffer () "Same as `org-agenda-tree-to-indirect-buffer' without saving window." -- 1.7.5.4