all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christian Moe <mail@christianmoe.com>
To: Neuwirth Erich <erich.neuwirth@univie.ac.at>
Cc: Bastien <bzg@altern.org>,
	"emacs-orgmode@gnu.org emacs-orgmode@gnu.org"
	<emacs-orgmode@gnu.org>
Subject: Re: Another tricky question: accessing named values
Date: Fri, 14 Sep 2012 11:24:46 +0200	[thread overview]
Message-ID: <5052F7DE.7020109@christianmoe.com> (raw)
In-Reply-To: <297435FE-72E9-4729-ADD8-5A9F3A28566B@univie.ac.at>

Hi,

You could just call the named block from inline:

: value equals call_myval()[:results raw]

The `:results raw' argument should take care of the formatting.

No macros needed. But if you want to use macros, e.g. because the call 
lines get very long, or you want to add fancy formatting around the 
result of each calculation (not what you're looking for here, I 
think), you could write a macro to expand to a call_<name>() expression.

Yours,
Christian



On 9/14/12 10:52 AM, Neuwirth Erich wrote:
> Define a name with a value
>
> #+name: myval
> #+begin_src elisp :exports both
> (+ 1 2)
> #+end_src
>
>
> The named value can be accessed in another code block
>
>
> #+begin_src elisp :session*elisp*  :var myval2=myval :exports both
> (setq myval3 myval2)
> myval2
> #+end_src
>
>
> I can also (with some trickery as shown above)
> use the value in running text: value equals
> src_elisp[:session*elisp*]{myval3}
>
> One of the minor annoyances here is that output of the inline src
> is always put between equals signs, and in some cases I would like the same
> formatting as the surrounding text.

      parent reply	other threads:[~2012-09-14  9:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-13 19:02 Another tricky question: accessing named values Neuwirth Erich
2012-09-14  7:33 ` Bastien
2012-09-14  8:52   ` Neuwirth Erich
2012-09-14  9:16     ` Sebastien Vauban
2012-09-14  9:24     ` Christian Moe [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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5052F7DE.7020109@christianmoe.com \
    --to=mail@christianmoe.com \
    --cc=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=erich.neuwirth@univie.ac.at \
    /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.