Bernt Hansen | 22 Jul 04:59 2011
Picon

Re: "DONE" all subtasks recursively

Marcelo de Moraes Serpa <celoserpa <at> gmail.com> writes:

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

--8<---------------cut here---------------start------------->8---
(defun bh/mark-subtree-done ()
  (interactive)
  (org-mark-subtree)
  (let ((limit (point)))
    (save-excursion
      (exchange-point-and-mark)
      (while (> (point) limit)
	(org-todo "DONE")
	(outline-previous-visible-heading 1))
      (org-todo "DONE"))))
--8<---------------cut here---------------end--------------->8---

Then M-x bh/mark-subtree-done.

This relies on the subtasks all being visible.  You can enhance it so it
handles folded tasks if needed.

-Bernt

>
> On Mon, Jul 18, 2011 at 1:30 PM, Marcelo de Moraes Serpa <
> celoserpa <at> 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?
>    
>     Thanks in advance,
>    
>     - Marcelo.
>    
>    
>    
>    
>
>
>
>

--

-- 
Bernt


Gmane