From fc1f01c54e5f9018374c15f11cf7b25c37996dd6 Mon Sep 17 00:00:00 2001 From: Bernt Hansen Date: Fri, 30 Dec 2011 15:49:08 +0000 Subject: [PATCH] Honour existing restrictions when clocking in from the agenda * 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 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 780794e08..f240f5e38 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."