From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: [PATCH 3/3] Honour existing restrictions when visiting tasks from the agenda Date: Fri, 30 Dec 2011 05:49:09 -0500 Message-ID: <1325242149-22487-4-git-send-email-bernt@norang.ca> References: <1325242149-22487-1-git-send-email-bernt@norang.ca> Return-path: Received: from eggs.gnu.org ([140.186.70.92]:54723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rga1p-0006YX-JV for emacs-orgmode@gnu.org; Fri, 30 Dec 2011 05:49:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rga1o-00031b-9j for emacs-orgmode@gnu.org; Fri, 30 Dec 2011 05:49:37 -0500 Received: from mho-03-ewr.mailhop.org ([204.13.248.66]:62396 helo=mho-01-ewr.mailhop.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rga1o-00030o-7u for emacs-orgmode@gnu.org; Fri, 30 Dec 2011 05:49:36 -0500 Received: from cpe000102d0fe75-cm0012256ecbde.cpe.net.cable.rogers.com ([72.136.255.45] helo=mail.norang.ca) by mho-01-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1Rga1h-0001Jj-FO for emacs-orgmode@gnu.org; Fri, 30 Dec 2011 10:49:29 +0000 In-Reply-To: <1325242149-22487-1-git-send-email-bernt@norang.ca> 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 Cc: Bernt Hansen * lisp/org-agenda.el (org-agenda-switch-to): Widen org buffer only if point is outside the current restriction Widen org buffer when visiting from agenda only if point is outside current restriction. Visiting a task with RET or TAB in the agenda should not affect the org-mode buffer restriction unless the target task is not currently visible due to the restriction. --- lisp/org-agenda.el | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index f240f5e..b009faf 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -7033,7 +7033,9 @@ at the text of the entry itself." (pos (marker-position marker))) (org-pop-to-buffer-same-window buffer) (and delete-other-windows (delete-other-windows)) - (widen) + (when (or (< pos (point-min)) + (> pos (point-max))) + (widen)) (goto-char pos) (when (eq major-mode 'org-mode) (org-show-context 'agenda) -- 1.7.8.247.g10f4e