emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fixing when org-clock-in-prepare-hook is called
@ 2012-10-26 11:47 Myles English
  2012-10-26 11:50 ` Sebastien Vauban
  2012-10-26 12:47 ` Bastien
  0 siblings, 2 replies; 3+ messages in thread
From: Myles English @ 2012-10-26 11:47 UTC (permalink / raw)
  To: Org mode


From d7c3f0a4611ced0a240af9115f29f888beb60af2 Mon Sep 17 00:00:00 2001
From: Myles English <mylesenglish@gmail.com>
Date: Fri, 26 Oct 2012 12:38:09 +0100
Subject: [PATCH] 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
---
 lisp/org-clock.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index e5488e4..84eb2fd 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1149,7 +1149,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
@@ -1168,6 +1167,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)
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fixing when org-clock-in-prepare-hook is called
  2012-10-26 11:47 [PATCH] Fixing when org-clock-in-prepare-hook is called Myles English
@ 2012-10-26 11:50 ` Sebastien Vauban
  2012-10-26 12:47 ` Bastien
  1 sibling, 0 replies; 3+ messages in thread
From: Sebastien Vauban @ 2012-10-26 11:50 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello Myles,

"Myles English" wrote:
> From d7c3f0a4611ced0a240af9115f29f888beb60af2 Mon Sep 17 00:00:00 2001
> From: Myles English <mylesenglish-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Date: Fri, 26 Oct 2012 12:38:09 +0100
> Subject: [PATCH] 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
> ---
>  lisp/org-clock.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lisp/org-clock.el b/lisp/org-clock.el
> index e5488e4..84eb2fd 100644
> --- a/lisp/org-clock.el
> +++ b/lisp/org-clock.el
> @@ -1149,7 +1149,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
> @@ -1168,6 +1167,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)

That hits me for months...

Tested your patch: the promised behavior does work as expected. Thanks!

Best regards,
  Seb

--
Sebastien Vauban

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fixing when org-clock-in-prepare-hook is called
  2012-10-26 11:47 [PATCH] Fixing when org-clock-in-prepare-hook is called Myles English
  2012-10-26 11:50 ` Sebastien Vauban
@ 2012-10-26 12:47 ` Bastien
  1 sibling, 0 replies; 3+ messages in thread
From: Bastien @ 2012-10-26 12:47 UTC (permalink / raw)
  To: Myles English; +Cc: Org mode

Hi Myles,

"Myles English" <mylesenglish@gmail.com> writes:

> * 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.

Applied, thanks a lot.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-26 13:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-26 11:47 [PATCH] Fixing when org-clock-in-prepare-hook is called Myles English
2012-10-26 11:50 ` Sebastien Vauban
2012-10-26 12:47 ` Bastien

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).