emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: mrb@hsdev.com
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Automatic tagging based on # of todo items as children
Date: Wed, 17 Feb 2010 18:43:42 +0100	[thread overview]
Message-ID: <20100217184342.3d4d5d06@hsdev.com> (raw)
In-Reply-To: <9F69ED3D-EF2E-4166-91D4-A2A102479268@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1243 bytes --]

On Tue 16-Feb-2010 05:53
Carsten Dominik <carsten.dominik@gmail.com> 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 #1.2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 1347 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2010-02-17 17:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-15 11:05 Automatic tagging based on # of todo items as children mrb
2010-02-16  4:53 ` Carsten Dominik
2010-02-17 17:43   ` mrb [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-02-15 10:27 Marcel van der Boom

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=20100217184342.3d4d5d06@hsdev.com \
    --to=mrb@hsdev.com \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).