From mboxrd@z Thu Jan 1 00:00:00 1970 From: Neuwirth Erich Subject: Re: Another tricky question: accessing named values Date: Fri, 14 Sep 2012 10:52:54 +0200 Message-ID: <297435FE-72E9-4729-ADD8-5A9F3A28566B@univie.ac.at> References: <9ED226CC-ABB1-4F17-B904-698CDBC193A0@univie.ac.at> <87fw6l2h4c.fsf@altern.org> Mime-Version: 1.0 (Mac OS X Mail 6.0 \(1486\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:35776) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCRe1-0007SH-PC for emacs-orgmode@gnu.org; Fri, 14 Sep 2012 04:53:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TCRdx-0002kG-Ek for emacs-orgmode@gnu.org; Fri, 14 Sep 2012 04:53:01 -0400 Received: from grace.univie.ac.at ([131.130.3.115]:37109) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCRdx-0002k8-4n for emacs-orgmode@gnu.org; Fri, 14 Sep 2012 04:52:57 -0400 In-Reply-To: <87fw6l2h4c.fsf@altern.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bastien Cc: "emacs-orgmode@gnu.org emacs-orgmode@gnu.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=3Dmyval :exports both (setq myval3 myval2) myval2 #+end_src I can also (with some trickery as shown above)=20 use the value in running text: value equals=20 src_elisp[:session *elisp*]{myval3} One of the minor annoyances here is that output of the inline src=20 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 =3Dmyval=3D into the argument = of the macro. I also would like to be able to say something like =3Devalorg(myval)=3D=20 and get the value of myval into my running text without any=20 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,=20 being able to the value of org names in a macro would solve my problem. On Sep 14, 2012, at 9:33 AM, Bastien wrote: > Hi Erich, >=20 > Neuwirth Erich writes: >=20 >> 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? >=20 > This is a bit cryptic to me. Care to give an example? >=20 > Thanks, >=20 > --=20 > Bastien