emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: Nathan Neff <nathan.neff@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Capture - stay clocked in?
Date: Mon, 28 Feb 2011 17:40:23 -0500	[thread overview]
Message-ID: <87fwr7okar.fsf@norang.ca> (raw)
In-Reply-To: <AANLkTikTPWsi4v42i_EdjQvouQ7V_ZvU=9zTxH88ppQi@mail.gmail.com> (Nathan Neff's message of "Mon, 28 Feb 2011 13:30:44 -0600")

Nathan Neff <nathan.neff@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

  reply	other threads:[~2011-02-28 22:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-28 19:30 Capture - stay clocked in? Nathan Neff
2011-02-28 22:40 ` Bernt Hansen [this message]
2011-03-06  0:13 ` Bastien
2011-03-07  3:35   ` Bernt Hansen
2011-03-07  8:23     ` Bastien
2011-03-07 10:20       ` Giovanni Ridolfi
2011-03-07 10:26         ` Bastien
2011-03-07 12:54           ` Carsten Dominik
2011-03-07 13:51             ` Bernt Hansen
2011-03-07 14:44               ` Bastien
2011-03-07 14:45             ` Bastien
2011-03-07 15:20               ` Bernt Hansen
2011-03-07 15:28                 ` Bastien
2011-03-07 15:55                   ` Bernt Hansen
2011-03-07 16:27                     ` Bastien
2011-03-07 18:13                       ` Bernt Hansen
2011-03-07 10:17     ` Bastien
2011-03-07 12:34       ` Bernt Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fwr7okar.fsf@norang.ca \
    --to=bernt@norang.ca \
    --cc=emacs-orgmode@gnu.org \
    --cc=nathan.neff@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).