Org-mode mailing list
 help / color / 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
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 index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-18 18:30 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://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

Org-mode mailing list

Archives are clonable:
	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git