Selaa lähdekoodia

Stop generating superfluous clock entries

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.

Patch by Bernt Hansen.

Modified by Carsten
Carsten Dominik 15 vuotta sitten
vanhempi
commit
364054fa77
2 muutettua tiedostoa jossa 13 lisäystä ja 0 poistoa
  1. 5 0
      lisp/ChangeLog
  2. 8 0
      lisp/org-clock.el

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2009-11-27  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-clock.el (org-clock-in): Do not restart the clock in the
+	same entry where it is running now.
+
 2009-11-26  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-footnote.el (org-footnote-normalize): Don't take optional

+ 8 - 0
lisp/org-clock.el

@@ -850,6 +850,14 @@ the clocking selection, associated with the letter `d'."
       (when interrupting
 	;; 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
+		(org-back-to-heading t)
+		(and (equal (marker-buffer org-clock-hd-marker)
+			    (current-buffer))
+		     (= (marker-position org-clock-hd-marker) (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))