1

I have multiple items in my org-mode, example:

* work                       wanted behavior when emacs startup
** item_1                  | ** item_1
Notes ...                  | ** item_2
** item_2                  | Notes...
Notes...                   |

my setup:

(require 'org)
(add-hook 'org-mode-hook (lambda ()
                           (local-set-key (kbd "C-c s") 'org-show-subtree)))

When I restart emacs all show up as expanded. Would it be possible to keep selected ones collapsed?

4

You can set the VISIBILITY property of an entry:

* work   
** item_1
:PROPERTIES:
:VISIBILITY: folded
:END:
   Notes

** item_2
:PROPERTIES:
:VISIBILITY: all
:END:
Notes

See the "Initial Visibility" section of the manual: C-h i g(org)initial visibility.

7
  • Is :END: required to be added?
    – alper
    Dec 16 '21 at 20:47
  • Still all shown unfolded :-( Should I also disable org-show-subtree ?
    – alper
    Dec 16 '21 at 20:50
  • Did you kill the buffer and reopen the file? This controls initial visibility only.
    – NickD
    Dec 16 '21 at 21:31
  • Yes, :END: is part of the drawer (any drawer, not just a properties drawer), but it gets inserted automatically if you create the properties drawer with C-c C-x p.
    – NickD
    Dec 17 '21 at 4:00
  • Yes I killed the buffer and emacs and re-open it. But everthing stills unfolded (not sure why) . Could org-show-subtree force to unfold all items?
    – alper
    Dec 17 '21 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.