From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ivanov Dmitry Subject: How to show/hide the snippet block in org-babel when the cursor is inside the snippet text Date: Tue, 16 Dec 2014 14:33:26 +0300 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=e89a8ff1cde0397ba0050a53bac1 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0qNf-00068L-B0 for emacs-orgmode@gnu.org; Tue, 16 Dec 2014 06:33:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0qNb-0000SX-QZ for emacs-orgmode@gnu.org; Tue, 16 Dec 2014 06:33:31 -0500 Received: from mail-ob0-x229.google.com ([2607:f8b0:4003:c01::229]:64123) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0qNb-0000SK-KI for emacs-orgmode@gnu.org; Tue, 16 Dec 2014 06:33:27 -0500 Received: by mail-ob0-f169.google.com with SMTP id vb8so22404133obc.0 for ; Tue, 16 Dec 2014 03:33:26 -0800 (PST) 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 --e89a8ff1cde0397ba0050a53bac1 Content-Type: text/plain; charset=UTF-8 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. --e89a8ff1cde0397ba0050a53bac1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I would like to implement the following. Suppose, we have = this org file:

#+BABEL: :cache yes :tangle yes :<=
span class=3D"">noweb yes

#+NAME: top_block
#+begin_src perl :tangle "=
;test.pl" :noweb tangle :shebang #!/usr/bin/perl
  use strict;
  use warnings;

  open(my $fh, "<",<=
/span> "test.txt"=
)
      or die "cannot open < file name: $!&q=
uot;;
  <<output-all=
>>
  close($fh);
#+end_src

#+NAME: output-all
#+begin_src perl
  while (my $line =3D <$fh>) <=
/span>{
      print $line;
  }
#+end_src

I can expand/collapse src blocks only wh=
en 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 c= ursor every time is
not nice.
--e89a8ff1cde0397ba0050a53bac1-- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Rettke 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 19:42:53 -0600 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b5d61941ce2e4050a5f981b Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y13dh-0002FX-8G for emacs-orgmode@gnu.org; Tue, 16 Dec 2014 20:42:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y13df-0004CE-Ny for emacs-orgmode@gnu.org; Tue, 16 Dec 2014 20:42:57 -0500 Received: from mail-wg0-x22a.google.com ([2a00:1450:400c:c00::22a]:61111) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y13df-0004C2-DS for emacs-orgmode@gnu.org; Tue, 16 Dec 2014 20:42:55 -0500 Received: by mail-wg0-f42.google.com with SMTP id k14so2785783wgh.15 for ; Tue, 16 Dec 2014 17:42:53 -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: Oleh Cc: "emacs-orgmode@gnu.org" , Ivanov Dmitry --047d7b5d61941ce2e4050a5f981b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I use `org-babel-next-src-block' and `org-babel-previous-src-block' to go up and down and rely on the org folding. Not a streamlined approach but it works because I use it rarely. On Tue, Dec 16, 2014 at 6:01 AM, Oleh wrote: > > 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 =3D <$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 > > --=20 Grant Rettke gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/ =E2=80=9CWisdom begins in wonder.=E2=80=9D --Socrates ((=CE=BB (x) (x x)) (=CE=BB (x) (x x))) =E2=80=9CLife has become immeasurably better since I have been forced to st= op taking it seriously.=E2=80=9D --Thompson --047d7b5d61941ce2e4050a5f981b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I use `org-babel-next-src-block' and `org-babel-previo= us-src-block' =C2=A0to go up and down and rely on the org folding. Not = a streamlined approach but it works because I use it rarely.

On Tue, Dec 16, 2014 at 6:= 01 AM, Oleh <ohwoeowho@gmail.com> wrote:
Hi Dmitry,

> I would like to implement the following. Suppose, we have this org fil= e:
>
> #+BABEL: :cache yes :tangle yes :noweb yes
>
> #+NAME: top_block
> #+begin_src perl :tangle "test.pl" :noweb tangle :shebang #!/usr/bin/perl
>=C2=A0 =C2=A0use strict;
>=C2=A0 =C2=A0use warnings;
>
>=C2=A0 =C2=A0open(my $fh, "<", "test.txt")
>=C2=A0 =C2=A0 =C2=A0 =C2=A0or die "cannot open < file name: $!&= quot;;
>=C2=A0 =C2=A0<<output-all>>
>=C2=A0 =C2=A0close($fh);
> #+end_src
>
> #+NAME: output-all
> #+begin_src perl
>=C2=A0 =C2=A0while (my $line =3D <$fh>) {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0print $line;
>=C2=A0 =C2=A0}
> #+end_src
>
> I can expand/collapse src blocks only when the cursor is on the top li= nes:
>
>
> #+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 a= nd fold many source
blocks within one heading.

regards,
Oleh



--
Grant Rettke
gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/
= =E2=80=9CWisdom begins in wonder.=E2=80=9D --Socrates
((=CE=BB (x) (x x)= ) (=CE=BB (x) (x x)))
=E2=80=9CLife has become immeasurably better since= I have been forced to stop taking it seriously.=E2=80=9D --Thompson
--047d7b5d61941ce2e4050a5f981b--