Matt Price <[email protected]> writes:
> Is there a command to fold all drawers in a buffer (all property
> drawers would be enough, actually)? Or a suggestion for how to do
> this? Thanks!
They might exist (with me unaware of them), but the following pair of commands
does the job, at least with this minimal test org snippet:
* A
:PROPERTIES:
:CUSTOM_ID: a1
:END:
* B
:PROPERTIES:
:CUSTOM_ID: B1
:END:
#+begin_src emacs-lisp
(defun org-show-drawers ()
"Unfold all drawers in buffer"
(interactive)
(save-excursion
(goto-char (point-min))
(while (not (eobp))
(and (org-at-drawer-p)
(org-element-property :hiddenp (org-element-at-point))
(org-cycle))
(forward-char))))
(defun org-hide-drawers ()
"Fold all drawers in buffer"
(interactive)
(save-excursion
(goto-char (point-min))
(while (not (eobp))
(and (org-at-drawer-p)
(not (org-element-property :hiddenp (org-element-at-point)))
(org-cycle))
(forward-char))))
#+end_src
#+results:
: org-hide-drawers
--
cheers,
Thorsten