emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: Marcelo de Moraes Serpa <celoserpa@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: "DONE" all subtasks recursively
Date: Thu, 21 Jul 2011 22:59:09 -0400	[thread overview]
Message-ID: <87aac7dnr6.fsf@norang.ca> (raw)
In-Reply-To: CACHMzOHcusAQsx725p0aj0BhuN_BkdHp9Ao6GyHTiTrkdyzB8Q@mail.gmail.com

Marcelo de Moraes Serpa <celoserpa@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@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

  parent reply	other threads:[~2011-07-22  2:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-18 18:30 "DONE" all subtasks recursively Marcelo de Moraes Serpa
2011-07-20 15:41 ` Marcelo de Moraes Serpa
2011-07-21  8:49   ` Aankhen
2011-07-22  2:59   ` Bernt Hansen [this message]
2011-07-22 13:52     ` Bastien

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=87aac7dnr6.fsf@norang.ca \
    --to=bernt@norang.ca \
    --cc=celoserpa@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).