Hello Marcelo, On Wed, Jul 20, 2011 at 21:11, Marcelo de Moraes Serpa <celose...@gmail.com> wrote: > *bump* > Hey guys, if someone could guide me a hint on where I should look to hack > some elisp code in order to do that, I'd be grateful ;) > Cheers, > Marcelo. > > On Mon, Jul 18, 2011 at 1:30 PM, Marcelo de Moraes Serpa > <celose...@gmail.com> wrote: >> >> Hey guys >> If I have a headline with children, like this: >> * Project >> ** TODO Task >> ** TODO Task >> ** SubProject >> *** TODO Task >> *** TODO Task >> Does org have any functionality that allows me to automatically close >> (Change TODO->DONE, put DONE when TODO is not available (in the case of >> Projects)) automatically and recursively for each child if I close the main >> parent headline?
You can use ‘org-map-region’ to call a function on every headline in a region. ‘org-end-of-subtree’ will move point to… well, the end of the current subtree. Finally, ‘org-todo’ is what changes the todo state of the headline containing point. Add your custom function to either ‘org-after-todo-state-change-hook’[1] or ‘org-trigger-hook’.[2] (I’m not sure what the difference is.) Happy hacking! Aankhen [1]: http://orgmode.org/worg/org-configs/org-hooks.html#sec-1_13 [2]: http://orgmode.org/worg/org-configs/org-hooks.html#sec-1_15