From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [PATCH] Add org-clock-out-manually Date: Thu, 9 Aug 2007 07:06:03 +0200 Message-ID: References: <873azdvk2l.fsf@gollum.intra.norang.ca> Mime-Version: 1.0 (Apple Message framework v624) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IJ0Dl-0004zB-Nn for emacs-orgmode@gnu.org; Thu, 09 Aug 2007 01:06:05 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IJ0Dk-0004xw-BD for emacs-orgmode@gnu.org; Thu, 09 Aug 2007 01:06:04 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IJ0Dk-0004xl-32 for emacs-orgmode@gnu.org; Thu, 09 Aug 2007 01:06:04 -0400 Received: from korteweg.uva.nl ([146.50.98.70]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IJ0Dj-0003UI-IP for emacs-orgmode@gnu.org; Thu, 09 Aug 2007 01:06:03 -0400 In-Reply-To: <873azdvk2l.fsf@gollum.intra.norang.ca> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bernt Hansen Cc: emacs-orgmode@gnu.org Hi Bernt, I have checked in a modified version of your patch, mostly I have changes the name of the variable to `org-clock-out-when-done', default t. Thanks! - Carsten On Jul 24, 2007, at 18:32, Bernt Hansen wrote: > Hi Carsten and list, > > I normally clock subtasks for a project when tracking time spent. I've > found stopping the clock automatically when a task is marked DONE > inconvenient because it leaves holes in my clocked day. Sometimes I > forget to clock in the next task on time (because the clock stopped and > I didn't notice) and with this patch I no longer have to fix up the > clock entries manually at the end of the day. > > The following patch changes the behaviour of the clock out function so > if org-clock-out-manually is set you have to stop the clock manually > (with C-c C-o in an org-mode buffer or O on the agenda). > > It's important for me to have accurate reporting of the time spent on a > project (an extra five minutes spent on SubTask A versus SubTask B > doesn't really matter but losing that 5 minutes from the project clock > matters) > > Hopefully this is useful for other people too. > > Bernt > > --- > Subject: [PATCH] Add org-clock-out-manually > > Allow the clocking task to continue when it is marked DONE. Setting > org-clock-out-manually now controls if a task clock stops when the > task is marked DONE. Clocking out is now a manual operation. > > When clocking tasks in a project such as > > * PROJECT ALPHA > ** TODO Task 1 > ** TODO Task 2 > ** TODO Task 3 > *** DONE SubTask A > CLOSED: [2007-07-21 Sat 00:05] > CLOCK: [2007-07-21 Sat 00:02]--[2007-07-21 Sat 00:09] => 0:07 > *** TODO SubTask B > CLOCK: [2007-07-21 Sat 00:09]--[2007-07-21 Sat 00:09] => 0:00 > > I often mark a task (say SubTask A) as DONE and the clock stops. I > then think about the project for a few minutes and forget to clock in > the next task. This leaves holes in my day which I have to manually > fix up. I'm still working on PROJECT ALPHA during this time and want > the timing of that project to continue. > > I could just clock PROJECT ALPHA and not the subtasks but it is useful > to know the time spent on the finer resolution tasks. > --- > org.el | 13 +++++++++++-- > 1 files changed, 11 insertions(+), 2 deletions(-) > > diff --git a/org.el b/org.el > index 1fc081e..e49aead 100644 > --- a/org.el > +++ b/org.el > @@ -1574,6 +1574,13 @@ When nil, no note will be taken." > :group 'org-progress > :type 'boolean) > > +(defcustom org-clock-out-manually nil > + "Non-nil means, the clock will continue timing the task when the > current TODO > +entry is marked DONE. Manually clocking out will stop the clock. > When nil, the > +clock will stop when the current TODO entry is marked DONE." > + :group 'org-progress > + :type 'boolean) > + > (defgroup org-priorities nil > "Priorities in Org-mode." > :tag "Org Priorities" > @@ -15642,7 +15649,8 @@ from the `before-change-functions' in the > current buffer." > 'org-remove-clock-overlays 'local)))) > > (defun org-clock-out-if-current () > - "Clock out if the current entry contains the running clock. > + "Clock out if the current entry contains the running clock and > +org-clock-out-manually is nil. > This is used to stop the clock after a TODO entry is marked DONE." > (when (and (member state org-done-keywords) > (equal (marker-buffer org-clock-marker) (current-buffer)) > @@ -15654,7 +15662,8 @@ This is used to stop the clock after a TODO > entry is marked DONE." > (member 'clock-out org-log-done)) > '(done) > org-log-done))) > - (org-clock-out)))) > + (unless org-clock-out-manually > + (org-clock-out))))) > > (add-hook 'org-after-todo-state-change-hook > 'org-clock-out-if-current) > -- > 1.5.3.rc2.22.g69a9b > > > > > _______________________________________________ > Emacs-orgmode mailing list > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > -- Carsten Dominik Sterrenkundig Instituut "Anton Pannekoek" Universiteit van Amsterdam Kruislaan 403 NL-1098SJ Amsterdam phone: +31 20 525 7477