emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dave Abrahams <dave@boostpro.com>
To: emacs-orgmode@gnu.org
Subject: Patch: maintain window configuration when org-agenda-follow-indirect is set
Date: Sun, 23 Oct 2011 15:17:37 -0400	[thread overview]
Message-ID: <m2bot77c1a.fsf@pluto.luannocracy.com> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0001-Maintain-stable-window-configuration-when-org-agenda.patch --]
[-- Type: text/x-patch, Size: 1804 bytes --]

From 5adafd491f520908c8ee180c1b0d63d877fa8547 Mon Sep 17 00:00:00 2001
From: Dave Abrahams <dave@boostpro.com>
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


[-- Attachment #2: Type: text/plain, Size: 63 bytes --]


-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com


             reply	other threads:[~2011-10-23 19:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-23 19:17 Dave Abrahams [this message]
2011-12-12 16:40 ` [Accepted] Patch: maintain window configuration when org-agenda-follow-indirect is set Bastien Guerry
2011-12-12 16:46 ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2bot77c1a.fsf@pluto.luannocracy.com \
    --to=dave@boostpro.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).