emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Oleh <ohwoeowho@gmail.com>
To: Ivanov Dmitry <usr345@gmail.com>
Cc: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <CAA01p3oy4eSW1Jx5+cR2B2xDxxQUQaQnBUyd99ezRE2n4S4ySA@mail.gmail.com> (raw)
In-Reply-To: <CAHyAE11iDyqnoG0+PvsjEv8mLtQuzcV+rKKQG+SJmFhGso5QYg@mail.gmail.com>

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: $!";
>   <<output-all>>
>   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

  reply	other threads:[~2014-12-16 12:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-16 11:33 How to show/hide the snippet block in org-babel when the cursor is inside the snippet text Ivanov Dmitry
2014-12-16 12:01 ` Oleh [this message]
2014-12-17  1:42   ` Grant Rettke

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=CAA01p3oy4eSW1Jx5+cR2B2xDxxQUQaQnBUyd99ezRE2n4S4ySA@mail.gmail.com \
    --to=ohwoeowho@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=usr345@gmail.com \
    /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).