emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: emacs-orgmode@gnu.org
Cc: Carsten Dominik <carsten.dominik@gmail.com>
Subject: Re: [RFC/PATCH v3] Stop generating superfluous clock entries
Date: Wed, 09 Dec 2009 06:31:02 -0500	[thread overview]
Message-ID: <87iqcg1j0p.fsf@gollum.intra.norang.ca> (raw)
In-Reply-To: <1259424434-332-1-git-send-email-bernt@norang.ca> (Bernt Hansen's message of "Sat\, 28 Nov 2009 11\:07\:14 -0500")

Bernt Hansen <bernt@norang.ca> writes:

> From: Carsten Dominik <carsten.dominik@gmail.com>
>
> Avoid closing the currently clocking entry when clocking in the same task
> again.  Leave the clock entry open until some other task is clocked in.
>
> This allows us to clock in tasks with hooks that are called frequently without
> generating lots of short sequential clock entries for the same task.
> ---
> Carsten,
>
> I think this patch works but I want to let it cook for a week or so before
> committing it in master.  The previous patches had issues clocking in with a
> prefix when not in an org-mode buffer.
>
> I've squashed the previous two reverted commits into this patch and added a
> check to prevent org-back-to-heading if we are using a selected task.
> There is also some whitespace cleanup at the bottom.
>
> This makes C-u C-c C-x C-i work in the agenda and non-org-mode buffers again.
>

I've added the following patch on top of this one for my work flow.  It
allows clocking in the same task and to update the modeline task name
and effort values.  I've been using both of these patches for a week
with no problems.

Both patches are available at git://git.norang.ca/org-mode clock-in

--8<---------------cut here---------------start------------->8---
From 8f62f61aab3c1940b2a4e0fb73562d900568463c Mon Sep 17 00:00:00 2001
From: Bernt Hansen <bernt@norang.ca>
Date: Wed, 2 Dec 2009 11:40:42 -0500
Subject: [PATCH] Update modeline with effort and task name on re-clock-in

Skip clocking out when we are clocking in the same task that
is currently clocking but go through the normal clock-in
setup so a modified task name or effort property is
updated in the modeline.
---
 lisp/org-clock.el |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 2d625ae..c13f4dd 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -857,7 +857,7 @@ the clocking selection, associated with the letter `d'."
 	;; We are interrupting the clocking of a different task.
 	;; Save a marker to this task, so that we can go back.
 	;; First check if we are trying to clock into the same task!
-	(when (save-excursion
+	(if (save-excursion
 		(unless selected-task
 		  (org-back-to-heading t))
 		(and (equal (marker-buffer org-clock-hd-marker)
@@ -868,12 +868,12 @@ the clocking selection, associated with the letter `d'."
 			(if selected-task
 			    (marker-position selected-task)
 			  (point)))))
-	  (message "Clock continues in \"%s\"" org-clock-heading)
-	  (throw 'abort nil))
-	(move-marker org-clock-interrupted-task
-		     (marker-position org-clock-marker)
-		     (marker-buffer org-clock-marker))
-	(org-clock-out t))
+	    (message "Clock continues in \"%s\"" org-clock-heading)
+	  (progn
+	    (move-marker org-clock-interrupted-task
+			 (marker-position org-clock-marker)
+			 (marker-buffer org-clock-marker))
+	    (org-clock-out t))))
 
       (when (equal select '(16))
 	;; Mark as default clocking task
-- 
1.6.6.rc1.39.g9a42

--8<---------------cut here---------------end--------------->8---

      reply	other threads:[~2009-12-09 11:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-27  2:21 [PATCH] Stop generating superfluous clock entries Bernt Hansen
2009-11-27  7:09 ` Carsten Dominik
2009-11-28 16:07   ` [RFC/PATCH v3] " Bernt Hansen
2009-12-09 11:31     ` Bernt Hansen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87iqcg1j0p.fsf@gollum.intra.norang.ca \
    --to=bernt@norang.ca \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).