From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleh Subject: Re: How to show/hide the snippet block in org-babel when the cursor is inside the snippet text Date: Tue, 16 Dec 2014 13:01:30 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37297) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0qoq-0007Ia-F6 for emacs-orgmode@gnu.org; Tue, 16 Dec 2014 07:01:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0qon-0000qw-DV for emacs-orgmode@gnu.org; Tue, 16 Dec 2014 07:01:36 -0500 Received: from mail-wg0-x234.google.com ([2a00:1450:400c:c00::234]:48459) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0qon-0000qk-7P for emacs-orgmode@gnu.org; Tue, 16 Dec 2014 07:01:33 -0500 Received: by mail-wg0-f52.google.com with SMTP id x12so17085264wgg.11 for ; Tue, 16 Dec 2014 04:01:31 -0800 (PST) In-Reply-To: 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: Ivanov Dmitry Cc: emacs-orgmode@gnu.org Hi Dmitry, > I would like to implement the following. Suppose, we have this org file: > > #+BABEL: :cache yes :tangle yes :noweb yes > > #+NAME: top_block > #+begin_src perl :tangle "test.pl" :noweb tangle :shebang #!/usr/bin/perl > use strict; > use warnings; > > open(my $fh, "<", "test.txt") > or die "cannot open < file name: $!"; > <> > close($fh); > #+end_src > > #+NAME: output-all > #+begin_src perl > while (my $line = <$fh>) { > print $line; > } > #+end_src > > I can expand/collapse src blocks only when the cursor is on the top lines: > > > #+NAME: top_block > #+begin_src perl ... > > But when it is inside any text in the scr block, expand/collapse doesn't > work. How can I add this functionality as moving the cursor every time is > not nice. There's a feature like this in https://github.com/abo-abo/worf (installable also from MELPA). If you're in a source block, "[" will bring you to its start, and "i" will hide/unhide it. You can use "j"/"k"/"i" to quickly navigate and fold many source blocks within one heading. regards, Oleh