emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Instructor account <instructor@andrew.cmu.edu>
To: Adriaan Sticker <adriaan.sticker@gmail.com>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: auto hiding src blocks upon toggling headers
Date: Wed, 08 Oct 2014 14:27:23 -0400	[thread overview]
Message-ID: <m2r3yiifhw.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <CAOrF+Ny60s=X6FLfPR1PTsRCysYogMngGXwOaqaaTCAT0jBb+Q@mail.gmail.com> (Adriaan Sticker's message of "Wed, 8 Oct 2014 15:26:05 +0200")

Adriaan Sticker <adriaan.sticker@gmail.com> writes:

This is not perfect but it seems close:

#+BEGIN_SRC emacs-lisp
(defun my-hide (state)
  (message "%s" state)
  (if (or (eq state 'children)
	  (eq state 'subtree))
      (save-restriction
	(org-narrow-to-subtree)
	(org-hide-block-all))))

(add-hook 'org-cycle-hook 'my-hide)
#+END_SRC




> Hi all
>
> Is there a way to automatically hide a source block when toggling the
> fold status of the parent header.
>
> Currently the hide status is remembered when folding its parent
> headers but this turned out not to be to practical in my current
> workflow.
>
> Greetings
>

-- 
-----------------------------------
John Kitchin
Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu

  reply	other threads:[~2014-10-08 19:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-08 13:26 auto hiding src blocks upon toggling headers Adriaan Sticker
2014-10-08 18:27 ` Instructor account [this message]
2014-10-08 23:33   ` John Kitchin
2014-10-09  9:11     ` Adriaan Sticker

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=m2r3yiifhw.fsf@andrew.cmu.edu \
    --to=instructor@andrew.cmu.edu \
    --cc=adriaan.sticker@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).