emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Neuwirth Erich <erich.neuwirth@univie.ac.at>
To: Bastien <bzg@altern.org>
Cc: "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 10:52:54 +0200	[thread overview]
Message-ID: <297435FE-72E9-4729-ADD8-5A9F3A28566B@univie.ac.at> (raw)
In-Reply-To: <87fw6l2h4c.fsf@altern.org>

Here is an example of what I would like.

#+title: Macro test


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.

Macros create output without additional formatting.

#+macro: testmac this is plain macro text

Before macro expanded :  {{{testmac}}} :  after macro expanded

Macros with arguments work nicely:

#+macro: testmacarg the argument is $1


{{{testmacarg(my argument)}}}


I would like to get the value of the name =myval= into the argument of the macro.

I also would like to be able to say something like

=evalorg(myval)= 

and get the value of myval into my running text without any 
additional formatting.

What I would like to be able to do is put results of computations
into running text. A typical example would be something like

 #+BEGIN_QUOTE
As the table above shows we hav 1217 cases in our analysis.
#+END_QUOTE

The number 1217 would come from a named code block, but it should
be typeset as running text, not as code text.

Since macros do the right kind of formatting, 
being able to  the value of org names in a macro would solve my problem.




On Sep 14, 2012, at 9:33 AM, Bastien <bzg@altern.org> wrote:

> Hi Erich,
> 
> Neuwirth Erich <erich.neuwirth@univie.ac.at> writes:
> 
>> Is there a way of accessing the value of something defined by a #name: statement as part of plain text,
>> of within the definition of a macro?
> 
> This is a bit cryptic to me.  Care to give an example?
> 
> Thanks,
> 
> -- 
> Bastien

  reply	other threads:[~2012-09-14  8:53 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 [this message]
2012-09-14  9:16     ` Sebastien Vauban
2012-09-14  9:24     ` Christian Moe

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=297435FE-72E9-4729-ADD8-5A9F3A28566B@univie.ac.at \
    --to=erich.neuwirth@univie.ac.at \
    --cc=bzg@altern.org \
    --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).