emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] [PATCH] Set org-clock-clocking-in when calling org-clock-out f


From: Bernt Hansen
Subject: [Orgmode] [PATCH] Set org-clock-clocking-in when calling org-clock-out from org-clock-in
Date: Thu, 20 May 2010 12:20:20 -0400

org-clock-out-hook can now query org-clock-clocking-in to see if org-clock-out 
is
being called inside org-clock-in.  This allows the hook to selectively clock
in another task without leaving clocks open.
---
Here's the updated patch which seems to work just as well.

This patch is available at git://git.norang.ca/org-mode.git persistent-clocking

Most of the changes here are whitespace.  The very last change in the patch is 
the 
only interesting part.

-Bernt

 lisp/org-clock.el |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 68a40ce..dbcd032 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -925,7 +925,7 @@ the clocking selection, associated with the letter `d'."
                             (org-clocking-p)))
          ts selected-task target-pos (msg-extra "")
          (leftover (and (not org-clock-resolving-clocks)
-                         org-clock-leftover-time)))
+                        org-clock-leftover-time)))
       (when (and org-clock-auto-clock-resolution
                 (or (not interrupting)
                     (eq t org-clock-auto-clock-resolution))
@@ -944,22 +944,23 @@ the clocking selection, associated with the letter `d'."
        ;; Save a marker to this task, so that we can go back.
        ;; First check if we are trying to clock into the same task!
        (if (save-excursion
-               (unless selected-task
-                 (org-back-to-heading t))
-               (and (equal (marker-buffer org-clock-hd-marker)
-                           (if selected-task
-                               (marker-buffer selected-task)
-                             (current-buffer)))
-                    (= (marker-position org-clock-hd-marker)
-                       (if selected-task
-                           (marker-position selected-task)
-                         (point)))))
+             (unless selected-task
+               (org-back-to-heading t))
+             (and (equal (marker-buffer org-clock-hd-marker)
+                         (if selected-task
+                             (marker-buffer selected-task)
+                           (current-buffer)))
+                  (= (marker-position org-clock-hd-marker)
+                     (if selected-task
+                         (marker-position selected-task)
+                       (point)))))
            (message "Clock continues in \"%s\"" org-clock-heading)
          (progn
            (move-marker org-clock-interrupted-task
                         (marker-position org-clock-marker)
                         (org-clocking-buffer))
-           (org-clock-out t))))
+           (let ((org-clock-clocking-in t))
+             (org-clock-out t)))))
 
       (when (equal select '(16))
        ;; Mark as default clocking task
-- 
1.7.1.86.g0e460




reply via email to

[Prev in Thread] Current Thread [Next in Thread]