emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Capture - stay clocked in?


From: Bernt Hansen
Subject: Re: [O] Capture - stay clocked in?
Date: Mon, 28 Feb 2011 17:40:23 -0500
User-agent: Gnus/5.110013 (No Gnus v0.13) Emacs/23.2 (gnu/linux)

Nathan Neff <address@hidden> writes:

> Is there an option NOT to clock out of a Todo item that's
> created using org-capture?
>
> I would like to use capture templates to define a new TODO task, and
> just stay clocked in to the new TODO.

I don't think there is an out-of-the-box way to do this today.  You can
add a hook to org-clock-out-hook that checks if you are completing a
capture and clock that task in again.  This might work okay if you
always want to do that.

My solution to this problem is just to clock in the interrupted task
again with F9-SPC.  Capture clocks in the capture task and clocks out
when it is filed, and the following function switches the clock back to
the last (captured) task.

--8<---------------cut here---------------start------------->8---
(global-set-key (kbd "<f9> SPC") 'bh/clock-in-last-task)

(defun bh/clock-in-last-task ()
  "Clock in the interrupted task if there is one
Skip the default task and get the next one"
  (interactive)
  (let ((clock-in-to-task (if (org-clock-is-active)
                              (if (equal org-clock-default-task (cadr 
org-clock-history))
                                  (caddr org-clock-history)
                                (cadr org-clock-history))
                            (if (equal org-clock-default-task (car 
org-clock-history))
                                (cadr org-clock-history)
                              (car org-clock-history)))))
    (org-with-point-at clock-in-to-task
      (org-clock-in nil))))

--8<---------------cut here---------------end--------------->8---

Regards,
Bernt



reply via email to

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