Nathan Neff <nathan.n...@gmail.com> 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

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to