[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] fold only DONE items at #+STARTUP
From: |
Nick Dokos |
Subject: |
Re: [O] fold only DONE items at #+STARTUP |
Date: |
Thu, 30 Jan 2014 18:22:33 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Piotr Isajew <address@hidden> writes:
> Hi Bastien,
>
> Dnia 29.01.2014 Bastien <address@hidden> napisaĆ/a:
>
>> Piotr Isajew <address@hidden> 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