From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: fold only DONE items at #+STARTUP
Date: Thu, 30 Jan 2014 18:22:33 -0500 [thread overview]
Message-ID: <87y51x5a2u.fsf@gmail.com> (raw)
In-Reply-To: slrnleli47.76c.pisajew@lnb.localnet
Piotr Isajew <pisajew@yahoo.com> writes:
> Hi Bastien,
>
> Dnia 29.01.2014 Bastien <bzg@gnu.org> napisał/a:
>
>> Piotr Isajew <pisajew@yahoo.com> writes:
>>
>>> For example, when I open .org file I would like to have subtrees
>>> marked as DONE folded, but the others should be opened as with
>>> #+STARTUP: content setting. Can it be done?
>>
>> No. But you can archive the DONE subtrees with C-c C-x C-a for
>> example. See "Archiving" in Org's manual.
>
> I haven't thought about archiving so thanks for pointing me to
> this. In general that could be the solution, but for this case it
> seems too drastic. It would mean excluding DONE subtrees from
> searches and clock reports which I don't want to happen before I
> finish entire project. What I want is just to initially get DONE
> subtrees out of my sight.
>
> I was able to achieve more or less what I wanted by setting
> VISIBILITY property with a hook:
>
> (defun set-visibility-to-folded-when-done()
> "Change default subtree VISIBILITY to folded when state is changed to DONE"
> ( when (string= org-state "DONE")
> (org-set-property "VISIBILITY" "folded"))
> )
> (add-hook 'org-after-todo-state-change-hook
> 'set-visibility-to-folded-when-done)
>
You might want to augment your function slightly with a call to
org-set-startup-visibility:
--8<---------------cut here---------------start------------->8---
(defun set-visibility-to-folded-when-done()
"Change default subtree VISIBILITY to folded when state is changed to DONE"
(when (string= org-state "DONE")
(org-set-property "VISIBILITY" "folded")
(org-set-startup-visibility)))
--8<---------------cut here---------------end--------------->8---
That will fold the item immediately.
--
Nick
next prev parent reply other threads:[~2014-01-30 23:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <slrnleie94.b57.pisajew@lnb.localnet>
2014-01-29 17:49 ` fold only DONE items at #+STARTUP Bastien
[not found] ` <slrnleli47.76c.pisajew@lnb.localnet>
2014-01-30 23:22 ` Nick Dokos [this message]
2014-01-31 12:19 ` John Kitchin
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y51x5a2u.fsf@gmail.com \
--to=ndokos@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.