emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Automatic tagging based on # of todo items as children


From: mrb
Subject: Re: [Orgmode] Automatic tagging based on # of todo items as children
Date: Wed, 17 Feb 2010 18:43:42 +0100

On Tue 16-Feb-2010 05:53
Carsten Dominik <address@hidden> wrote:

> there is not simple other way, because only when making TODO  
> statistics are the TODO children counted.  You can hook into `org- 
> after-todo-state-change-hook' with a function that moves back up to  
> the parent and then counts children with TODO keyword.
> 
> THis is untested:
> 
> (defun my-define-prj ()
>    (save-excursion
>      (when (org-up-heading-safe)
>        (let ((beg (point))
>           (end (org-end-of-subtree t t))
>           two-not-done)
>       (goto-char beg)
>       (goto-char (point-at-eol))
>       (setq two-not-done
>             (and (re-search-forward org-not-done-heading-regexp end
> t) (re-search-forward org-not-done-heading-regexp end t)))
>       (goto-char beg)
>       (org-toggle-tag "prj" (if two-not-done 'on 'off))))))
> 
> (add-hook 'org-after-todo-state-change-hook 'my-define-prj)
> 

Thanks! That is close enough at this time. It neatly adds/removes the
tag when there are more/less than 2 open TODO items.  

marcel

-- 
Marcel van der Boom  -- http://hsdev.com/mvdb.vcf
HS-Development BV    -- http://www.hsdev.com
So! web applications -- http://make-it-so.info
Cobra build          -- http://cobra.mrblog.nl

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]