From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Abrahams Subject: Patch: maintain window configuration when org-agenda-follow-indirect is set Date: Sun, 23 Oct 2011 15:17:37 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:40546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RI3Yg-0008Qg-QN for emacs-orgmode@gnu.org; Sun, 23 Oct 2011 15:18:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RI3Yf-0006Ot-CA for emacs-orgmode@gnu.org; Sun, 23 Oct 2011 15:18:10 -0400 Received: from lo.gmane.org ([80.91.229.12]:60807) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RI3Ye-0006Oo-Qz for emacs-orgmode@gnu.org; Sun, 23 Oct 2011 15:18:09 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RI3Ye-0008PX-57 for emacs-orgmode@gnu.org; Sun, 23 Oct 2011 21:18:08 +0200 Received: from 207-172-223-249.c3-0.smr-ubr3.sbo-smr.ma.static.cable.rcn.com ([207.172.223.249]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 23 Oct 2011 21:18:08 +0200 Received: from dave by 207-172-223-249.c3-0.smr-ubr3.sbo-smr.ma.static.cable.rcn.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 23 Oct 2011 21:18:08 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Maintain-stable-window-configuration-when-org-agenda.patch >From 5adafd491f520908c8ee180c1b0d63d877fa8547 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sun, 23 Oct 2011 14:41:44 -0400 Subject: [PATCH] Maintain stable window configuration when org-agenda-follow-indirect is set Without this change, org-agenda-follow-indirect tends to cause the window configration to bounce around chaotically as you move from item to item. --- lisp/org-agenda.el | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index e4b1ba5..639ee23 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -7168,6 +7168,23 @@ With numerical prefix arg ARG, go up to this level and then take that tree. With a \\[universal-argument] prefix, make a separate frame for this tree (i.e. don't use the dedicated frame)." (interactive) + (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))) + (save-window-excursion (org-agenda-do-tree-to-indirect-buffer)) + (unwind-protect + (progn + (unless indirect-window + (setq indirect-window (split-window agenda-window))) + (select-window indirect-window) + (switch-to-buffer org-last-indirect-buffer :norecord) + (fit-window-to-buffer indirect-window)) + (select-window agenda-window))))) + +(defun org-agenda-do-tree-to-indirect-buffer () + "Implements org-agenda-tree-to-indirect-buffer, but +doesn't attempt to manage stability of the window configuration." (org-agenda-check-no-diary) (let* ((marker (or (org-get-at-bol 'org-marker) (org-agenda-error))) -- 1.7.6.1 --=-=-= Content-Type: text/plain -- Dave Abrahams BoostPro Computing http://www.boostpro.com --=-=-=--