emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* stop clocking in from changing todo state for a subtree
@ 2012-12-06  8:13 Rainer Stengele
  2012-12-06 11:45 ` Bernt Hansen
  0 siblings, 1 reply; 2+ messages in thread
From: Rainer Stengele @ 2012-12-06  8:13 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

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?

Thanks!

Rainer

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: stop clocking in from changing todo state for a subtree
  2012-12-06  8:13 stop clocking in from changing todo state for a subtree Rainer Stengele
@ 2012-12-06 11:45 ` Bernt Hansen
  0 siblings, 0 replies; 2+ messages in thread
From: Bernt Hansen @ 2012-12-06 11:45 UTC (permalink / raw)
  To: Rainer Stengele; +Cc: emacs-orgmode

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---

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-06 11:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-06  8:13 stop clocking in from changing todo state for a subtree Rainer Stengele
2012-12-06 11:45 ` Bernt Hansen

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).