Browse Source

Clocking: Fix bug in the new cocking code

The cursor could move while collecting the total time for the current
subtree.
Carsten Dominik 16 năm trước cách đây
mục cha
commit
5ce1c5708f
2 tập tin đã thay đổi với 8 bổ sung4 xóa
  1. 3 0
      lisp/ChangeLog
  2. 5 4
      lisp/org-clock.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2009-05-28  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-clock.el (org-clock-sum-current-item): Fix positioning bug
+	when retrieving total clocked time in the subtree.
+
 	* org.el (org-quoting-blocks): New variable.
 
 2009-05-27  Carsten Dominik  <carsten.dominik@gmail.com>

+ 5 - 4
lisp/org-clock.el

@@ -289,10 +289,11 @@ pointing to it."
 
 (defun org-clock-sum-current-item ()
   "Returns time, clocked on current item in total"
-  (save-restriction
-    (org-narrow-to-subtree)
-    (org-clock-sum)
-    org-clock-file-total-minutes))
+  (save-excursion
+    (save-restriction
+      (org-narrow-to-subtree)
+      (org-clock-sum)
+      org-clock-file-total-minutes)))
 
 (defun org-clock-get-clock-string ()
   "Form a clock-string, that will be show in the mode line.