From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: [PATCH 2/3] Honour existing restrictions when clocking in from the agenda Date: Fri, 30 Dec 2011 05:49:08 -0500 Message-ID: <1325242149-22487-3-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]:54734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rga1r-0006f3-EB for emacs-orgmode@gnu.org; Fri, 30 Dec 2011 05:49:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rga1p-00031q-RX for emacs-orgmode@gnu.org; Fri, 30 Dec 2011 05:49:39 -0500 Received: from mho-03-ewr.mailhop.org ([204.13.248.66]:46950 helo=mho-01-ewr.mailhop.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rga1p-00030s-Pe for emacs-orgmode@gnu.org; Fri, 30 Dec 2011 05:49:37 -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 1Rga1j-0001OF-1H for emacs-orgmode@gnu.org; Fri, 30 Dec 2011 10:49:31 +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-clock-in): Save restriction when clocking in from the agenda Narrowed org buffers are now retained when clocking in from the agenda. We only widen the buffer when the task to clock in is outside the existing restriction. --- lisp/org-agenda.el | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 780794e..f240f5e 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -7797,14 +7797,15 @@ The cursor may be at a date in the calendar, or in the Org agenda." newhead) (org-with-remote-undo (marker-buffer marker) (with-current-buffer (marker-buffer marker) - (widen) - (goto-char pos) - (org-show-context 'agenda) - (org-show-entry) - (org-cycle-hide-drawers 'children) - (org-clock-in arg) - (setq newhead (org-get-heading))) - (org-agenda-change-all-lines newhead hdmarker))))) + (save-restriction + (widen) + (goto-char pos) + (org-show-context 'agenda) + (org-show-entry) + (org-cycle-hide-drawers 'children) + (org-clock-in arg) + (setq newhead (org-get-heading))) + (org-agenda-change-all-lines newhead hdmarker)))))) (defun org-agenda-clock-out () "Stop the currently running clock." -- 1.7.8.247.g10f4e