emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to show/hide the snippet block in org-babel when the cursor is inside the snippet text
@ 2014-12-16 11:33 Ivanov Dmitry
  2014-12-16 12:01 ` Oleh
  0 siblings, 1 reply; 3+ messages in thread
From: Ivanov Dmitry @ 2014-12-16 11:33 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 725 bytes --]

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.

[-- Attachment #2: Type: text/html, Size: 3255 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to show/hide the snippet block in org-babel when the cursor is inside the snippet text
  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
  2014-12-17  1:42   ` Grant Rettke
  0 siblings, 1 reply; 3+ messages in thread
From: Oleh @ 2014-12-16 12:01 UTC (permalink / raw)
  To: Ivanov Dmitry; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to show/hide the snippet block in org-babel when the cursor is inside the snippet text
  2014-12-16 12:01 ` Oleh
@ 2014-12-17  1:42   ` Grant Rettke
  0 siblings, 0 replies; 3+ messages in thread
From: Grant Rettke @ 2014-12-17  1:42 UTC (permalink / raw)
  To: Oleh; +Cc: emacs-orgmode@gnu.org, Ivanov Dmitry

[-- Attachment #1: Type: text/plain, Size: 1757 bytes --]

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 <ohwoeowho@gmail.com> 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: $!";
> >   <<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
>
>

-- 
Grant Rettke
gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson

[-- Attachment #2: Type: text/html, Size: 2715 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-17  1:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2014-12-17  1:42   ` Grant Rettke

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).