* [PATCH] Fix J in agenda when clock out hook clocks in again
@ 2012-02-09 17:43 Bernt Hansen
2012-02-12 18:48 ` [Accepted] " David Maus
0 siblings, 1 reply; 2+ messages in thread
From: Bernt Hansen @ 2012-02-09 17:43 UTC (permalink / raw
To: emacs-orgmode; +Cc: Bernt Hansen
* org-clock.el (org-clock-out): Do not delete the current clocking task
when org-clock-out-hook clocks in another task
My clock out hook keeps the clock running by automatically clocking in
a new task (the parent task, or the default task). This sets a new
clocking task which was then clobbered at the end of org-clock-out
so that J in the agenda would return
"No running clock, use `C-c C-x C-j' to jump to the most recent one"
We now detect that another task is clocked in and skip clearing the
org-clock-current-task variable used by the agenda to determine if
the clock is currently running.
---
lisp/org-clock.el | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index a1df776..7dff094 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1387,7 +1387,8 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
(message (concat "Clock stopped at %s after HH:MM = " org-time-clocksum-format "%s") te h m
(if remove " => LINE REMOVED" ""))
(run-hooks 'org-clock-out-hook)
- (org-clock-delete-current))))))
+ (unless (org-clocking-p)
+ (org-clock-delete-current)))))))
(add-hook 'org-clock-out-hook 'org-clock-remove-empty-clock-drawer)
--
1.7.9.48.g85da4d
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Accepted] Fix J in agenda when clock out hook clocks in again
2012-02-09 17:43 [PATCH] Fix J in agenda when clock out hook clocks in again Bernt Hansen
@ 2012-02-12 18:48 ` David Maus
0 siblings, 0 replies; 2+ messages in thread
From: David Maus @ 2012-02-12 18:48 UTC (permalink / raw
To: emacs-orgmode
Patch 1160 (http://patchwork.newartisans.com/patch/1160/) is now "Accepted".
Maintainer comment: none
This relates to the following submission:
http://mid.gmane.org/%3C1328809420-31933-1-git-send-email-bernt%40norang.ca%3E
Here is the original message containing the patch:
> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [O] Fix J in agenda when clock out hook clocks in again
> Date: Thu, 09 Feb 2012 22:43:40 -0000
> From: Bernt Hansen <bernt@norang.ca>
> X-Patchwork-Id: 1160
> Message-Id: <1328809420-31933-1-git-send-email-bernt@norang.ca>
> To: emacs-orgmode@gnu.org
> Cc: Bernt Hansen <bernt@norang.ca>
>
> * org-clock.el (org-clock-out): Do not delete the current clocking task
> when org-clock-out-hook clocks in another task
>
> My clock out hook keeps the clock running by automatically clocking in
> a new task (the parent task, or the default task). This sets a new
> clocking task which was then clobbered at the end of org-clock-out
> so that J in the agenda would return
>
> "No running clock, use `C-c C-x C-j' to jump to the most recent one"
>
> We now detect that another task is clocked in and skip clearing the
> org-clock-current-task variable used by the agenda to determine if
> the clock is currently running.
>
> ---
> lisp/org-clock.el | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/lisp/org-clock.el b/lisp/org-clock.el
> index a1df776..7dff094 100644
> --- a/lisp/org-clock.el
> +++ b/lisp/org-clock.el
> @@ -1387,7 +1387,8 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
> (message (concat "Clock stopped at %s after HH:MM = " org-time-clocksum-format "%s") te h m
> (if remove " => LINE REMOVED" ""))
> (run-hooks 'org-clock-out-hook)
> - (org-clock-delete-current))))))
> + (unless (org-clocking-p)
> + (org-clock-delete-current)))))))
>
> (add-hook 'org-clock-out-hook 'org-clock-remove-empty-clock-drawer)
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-02-12 18:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-09 17:43 [PATCH] Fix J in agenda when clock out hook clocks in again Bernt Hansen
2012-02-12 18:48 ` [Accepted] " David Maus
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.