Browse Source

Clocking: Move to task before calling org-clock-in-prepare-hook

* lisp/org-clock.el (org-clock-in): Moved the call to
org-clock-in-prepare-hook until the task's properties
can be accessed.

The problem was when using a function to add an effort
property via the hook, it would not recognise an existing
effort property when called with the prefix (C-u C-c C-x C-i)
with the point at a place other than at the task.

TINYCHANGE
Myles English 5 years ago
parent
commit
db8e06147a
1 changed files with 1 additions and 1 deletions
  1. 1 1
      lisp/org-clock.el

+ 1 - 1
lisp/org-clock.el

@@ -1138,7 +1138,6 @@ make this the default behavior.)"
 	    (if (and (eobp) (not (org-at-heading-p)))
 		(point-at-bol 0)
 	      (point)))
-      (run-hooks 'org-clock-in-prepare-hook)
       (save-excursion
 	(when (and selected-task (marker-buffer selected-task))
 	  ;; There is a selected task, move to the correct buffer
@@ -1157,6 +1156,7 @@ make this the default behavior.)"
 	      ;; beginning of the heading, since the
 	      ;; user is liking to insert stuff here
 	      ;; manually
+	      (run-hooks 'org-clock-in-prepare-hook)
 	      (org-clock-history-push))
 	    (org-clock-set-current)
 	    (cond ((functionp org-clock-in-switch-to-state)