emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: arne@arne-koehn.de (Arne Köhn)
To: emacs-orgmode@gnu.org
Subject: Re: babel: is it possible to cache #+call executed blocks
Date: Fri, 03 Aug 2012 18:04:19 +0200	[thread overview]
Message-ID: <87haskj724.fsf@meinschatz.hause> (raw)
In-Reply-To: <87hatv4i9w.fsf@online.de> ("Jonas \=\?utf-8\?Q\?H\=C3\=B6rsch\=22's\?\= message of "Thu, 28 Jun 2012 16:34:35 +0200")

coroa@online.de (Jonas Hörsch) writes:

> i'm looking for a possibilty to call lengthy codeblocks a few times with
> different parameters, but would like the results to be cached.

It's probably a bit late, but I stumbled over the same problem. Here is
how I dealt with it (it's not that pretty).

Instead of

,----
|  #+call foofunc(bar=baz)
`----

I wrote a emacs-lisp block doing the same:

,----
| #+name: speak_world
| #+begin_src emacs-lisp :cache yes
|   (save-excursion
|     (goto-char (org-babel-find-named-block "speak"))
|     (org-babel-execute-src-block nil nil '((:var "say=world")))
|   )
| #+end_src
`----

In contrast to #+call, this results in a cached result for foo_bar that
can be accessed later on.

The disadvantages:
 - the cached result will never be invalidated (since foo_bar doesn't
   change)
 - somehow the variable bar will not be "baz" but "baz=", I changed my
   code block to strip the trailing "=".

If someone could point out where this "=" comes from: please tell me!


Arne

  reply	other threads:[~2012-08-03 16:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-28 14:34 babel: is it possible to cache #+call executed blocks Jonas Hörsch
2012-08-03 16:04 ` Arne Köhn [this message]
2012-08-03 19:30   ` Eric Schulte

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=87haskj724.fsf@meinschatz.hause \
    --to=arne@arne-koehn.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 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).