emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: Rainer Stengele <rainer.stengele@online.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: stop clocking in from changing todo state for a subtree
Date: Thu, 06 Dec 2012 06:45:17 -0500	[thread overview]
Message-ID: <87obi7l7zm.fsf@norang.ca> (raw)
In-Reply-To: <k9pk3k$m0t$1@ger.gmane.org> (Rainer Stengele's message of "Thu, 06 Dec 2012 09:13:43 +0100")

Hi Rainer,

Rainer Stengele <rainer.stengele@online.de> writes:

> Clocking in changes my TODO state from TODO to INWORK, which is ok.
>
> I have some tasks which I want to stay with the initial TODO state when
> clocking time to it.
> Can I configure this behavior through a property inhibiting the state
> change when clocking?

Sure you can with an appropriate hook function.

This is what I use to prevent clock in to NEXT when it is a capture task
or a project/subproject (ie. any task with subtasks)

You can modify it to use a property instead to achieve what you want.

The helper functions (bh/is-task-p, bh/is-project-p) are available at
http://doc.norang.ca/org-mode.html

Regards,
Bernt

--8<---------------cut here---------------start------------->8---
;; Change tasks to NEXT when clocking in
(setq org-clock-in-switch-to-state 'bh/clock-in-to-next)

(defun bh/clock-in-to-next (kw)
  "Switch a task from TODO to NEXT when clocking in.
Skips capture tasks, projects, and subprojects.
Switch projects and subprojects from NEXT back to TODO"
  (when (not (and (boundp 'org-capture-mode) org-capture-mode))
    (cond
     ((and (member (org-get-todo-state) (list "TODO"))
           (bh/is-task-p))
      "NEXT")
     ((and (member (org-get-todo-state) (list "NEXT"))
           (bh/is-project-p))
      "TODO"))))
--8<---------------cut here---------------end--------------->8---

      reply	other threads:[~2012-12-06 11:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-06  8:13 stop clocking in from changing todo state for a subtree Rainer Stengele
2012-12-06 11:45 ` Bernt Hansen [this message]

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=87obi7l7zm.fsf@norang.ca \
    --to=bernt@norang.ca \
    --cc=emacs-orgmode@gnu.org \
    --cc=rainer.stengele@online.de \
    /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).