emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Have :var reference a value
@ 2019-12-08 16:52 George Mauer
  2019-12-08 18:18 ` Berry, Charles
  0 siblings, 1 reply; 2+ messages in thread
From: George Mauer @ 2019-12-08 16:52 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 491 bytes --]

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?

[-- Attachment #2: Type: text/html, Size: 704 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Have :var reference a value
  2019-12-08 16:52 Have :var reference a value George Mauer
@ 2019-12-08 18:18 ` Berry, Charles
  0 siblings, 0 replies; 2+ messages in thread
From: Berry, Charles @ 2019-12-08 18:18 UTC (permalink / raw)
  To: gmauer@gmail.com; +Cc: emacs-orgmode



> On Dec 8, 2019, at 8:52 AM, George Mauer <gmauer@gmail.com> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-08 18:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-08 16:52 Have :var reference a value George Mauer
2019-12-08 18:18 ` Berry, Charles

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).