emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <eric.schulte@gmx.com>
To: "Arne Köhn" <arne@arne-koehn.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: babel: is it possible to cache #+call executed blocks
Date: Fri, 03 Aug 2012 13:30:33 -0600	[thread overview]
Message-ID: <874nojvkme.fsf@gmx.com> (raw)
In-Reply-To: <87haskj724.fsf@meinschatz.hause> ("Arne Köhn"'s message of "Fri, 03 Aug 2012 18:04:19 +0200")

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

arne@arne-koehn.de (Arne Köhn) writes:

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

Use #+call lines with the :cache header argument set.  With a recent
version of Org-mode the following should work as expected.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: call-cache.org --]
[-- Type: text/x-org, Size: 486 bytes --]

#+Title: An Example of Using the Cache Header Argument with Call Lines

A long running code block.
#+name: foo
#+begin_src emacs-lisp :var bar="baz"
  (sit-for 5)
  (message "bar=%S" bar)
#+end_src

#+RESULTS: foo
: bar="baz"

This returns immediately thanks to the cached result.
#+call: foo("qux") :cache yes

#+RESULTS[49bbb37e59694c557889ca8fd4b06fe0d4fb6b25]: foo("qux"):cache yes
: bar="qux"

This does not return immediately, because the block must execute.
#+call: foo("quxxx")

[-- Attachment #3: Type: text/plain, Size: 46 bytes --]


-- 
Eric Schulte
http://cs.unm.edu/~eschulte

      reply	other threads:[~2012-08-03 19:31 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
2012-08-03 19:30   ` Eric Schulte [this message]

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=874nojvkme.fsf@gmx.com \
    --to=eric.schulte@gmx.com \
    --cc=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).