[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Have :var reference a value
From: |
Berry, Charles |
Subject: |
Re: Have :var reference a value |
Date: |
Sun, 8 Dec 2019 18:18:32 +0000 |
> On Dec 8, 2019, at 8:52 AM, George Mauer <address@hidden> wrote:
>
> I'm playing around with learning racket in an org buffer and I have a bunch
> of blocks that look like this
>
> #+begin_src racket :var value="abbracadaabra"
> ...do stuff with value...
> #+end_src
>
>
> #+begin_src racket :var value="abbracadaabra"
> ...do other stuff with value...
> #+end_src
>
> Is there a way to move the "abbracadaabra" string into a single location so
> that I can just pull the var from that? I know I can put it in a table or a
> list, but how about into a single value?
Make it a property:
#+PROPERTY: magic abbracadabra
#+begin_src emacs-lisp :var value=(org-entry-get (point) "magic" t)
value
#+end_src
#+RESULTS:
: abbracadabra
When you add/change a property like this be sure to update (C-c C-c on the
PROPERTY line or save, close, open the file).
For a long string, you might put it in a src block and then use :var
value=block-name() to get it.
HTH,
Chuck