emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] fold all drawers in a buffer?


From: Thorsten Jolitz
Subject: Re: [O] fold all drawers in a buffer?
Date: Fri, 01 Nov 2013 16:52:29 +0100
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux)

Matt Price <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]