diff options
author | Bernt Hansen <bernt@norang.ca> | 2011-12-30 05:49:08 -0500 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2012-01-11 16:42:34 +0100 |
commit | c41a6f5a333441ba68029c6f8792c9a9938fc57c (patch) | |
tree | 955ac250a64e16bb1bd54451e56487b9b66a8996 | |
parent | a0a26cddda56e493322de3926b1f9eedfde18332 (diff) | |
download | org-mode-c41a6f5a333441ba68029c6f8792c9a9938fc57c.tar.gz |
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.
-rw-r--r-- | 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 bdf6881..e45ee14 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -7877,14 +7877,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." |