emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: fold all drawers in a buffer?
Date: Fri, 01 Nov 2013 16:52:29 +0100	[thread overview]
Message-ID: <87ppqkktky.fsf@gmail.com> (raw)
In-Reply-To: CAN_Dec-OZaSEYz7upYe4F0Ct8BRpY8FQmjw3+POEqc1MpGZk5Q@mail.gmail.com

Matt Price <moptop99@gmail.com> 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	other threads:[~2013-11-01 15:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-01 13:46 fold all drawers in a buffer? Matt Price
2013-11-01 15:52 ` Thorsten Jolitz [this message]
2013-11-01 16:43   ` Thorsten Jolitz
2013-11-01 18:34     ` Aaron Ecay
2013-11-01 19:28       ` Thorsten Jolitz

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ppqkktky.fsf@gmail.com \
    --to=tjolitz@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).