[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] stop clocking in from changing todo state for a subtree
From: |
Bernt Hansen |
Subject: |
Re: [O] stop clocking in from changing todo state for a subtree |
Date: |
Thu, 06 Dec 2012 06:45:17 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Hi Rainer,
Rainer Stengele <address@hidden> 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---