From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Re: fold all drawers in a buffer? Date: Fri, 01 Nov 2013 16:52:29 +0100 Message-ID: <87ppqkktky.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VcH1m-0008Fn-Lm for emacs-orgmode@gnu.org; Fri, 01 Nov 2013 11:52:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VcH1f-00071O-6y for emacs-orgmode@gnu.org; Fri, 01 Nov 2013 11:52:50 -0400 Received: from plane.gmane.org ([80.91.229.3]:36352) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VcH1e-00071H-WE for emacs-orgmode@gnu.org; Fri, 01 Nov 2013 11:52:43 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VcH1d-00076A-1f for emacs-orgmode@gnu.org; Fri, 01 Nov 2013 16:52:41 +0100 Received: from g231108014.adsl.alicedsl.de ([92.231.108.14]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 01 Nov 2013 16:52:41 +0100 Received: from tjolitz by g231108014.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 01 Nov 2013 16:52:41 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Matt Price 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