emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Another tricky question: accessing named values


From: Neuwirth Erich
Subject: Re: [O] Another tricky question: accessing named values
Date: Fri, 14 Sep 2012 10:52:54 +0200

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 <address@hidden> wrote:

> Hi Erich,
> 
> Neuwirth Erich <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]