From: Nick Dokos <nicholas.dokos@hp.com>
To: Rainer@krugs.de
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: remove all #+RESULTS blocks in a file?
Date: Wed, 22 Aug 2012 11:01:16 -0400 [thread overview]
Message-ID: <12396.1345647676@alphaville> (raw)
In-Reply-To: Message from Rainer M Krug <r.m.krug@gmail.com> of "Wed, 22 Aug 2012 15:25:38 +0200." <5034DDD2.8090000@gmail.com>
Rainer M Krug <r.m.krug@gmail.com> wrote:
> Hi
>
> I want to remove all #+RESULTS blocks in a file / section. org-babel-remove-result works nicely for
> a single block, but when the cursor is in a heading (e.g. in Test), only the first block is removed.
>
> Is this a bug or a feature?
>
> If a feature, is there a way of removing *all* #+RESULTS bocks in a file?
>
> Thanks,
>
> Rainer
>
>
> * Test
> #+begin_src sh :output both
> echo Test
> #+end_src
>
> #+RESULTS:
> : Test
>
> #+begin_src sh :output both
> echo Test
> #+end_src
>
> #+RESULTS:
> : Test
>
>
Although the following will do in a pinch, it is *not* the
best solution: it uses a string match to step from code block
to code block, instead of using org-element; but the idea is
the same, so the org-element solution is left as an exercise for
the interested reader :-)
Note that org-babel-remove-result presupposes that
point is in the corresponding source block: you can't blindly
use it from anywhere.
--8<---------------cut here---------------start------------->8---
(defun rmk-org-remove-all-result-blocks ()
(interactive)
(save-excursion
(goto-char (point-min))
(while (search-forward "#+begin_src " nil t)
(org-babel-remove-result))))
--8<---------------cut here---------------end--------------->8---
Nick
next prev parent reply other threads:[~2012-08-22 15:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-24 12:22 Simplify repeated same section with different variable value Rainer M Krug
2012-04-24 12:36 ` Myles English
2012-04-24 13:01 ` Rainer M Krug
2012-04-24 13:43 ` Toby Cubitt
[not found] ` <r.m.krug@gmail.com>
2012-04-24 14:44 ` Nick Dokos
2012-04-24 22:25 ` Darlan Cavalcante Moreira
2012-04-25 8:57 ` Rainer M Krug
2012-08-22 15:01 ` Nick Dokos [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-08-22 13:25 remove all #+RESULTS blocks in a file? Rainer M Krug
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=12396.1345647676@alphaville \
--to=nicholas.dokos@hp.com \
--cc=Rainer@krugs.de \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.