From: Rainer M Krug <Rainer@krugs.de>
To: Jarmo Hurri <jarmo.hurri@iki.fi>
Cc: emacs-orgmode@gnu.org
Subject: Re: Local variables in an org file
Date: Fri, 21 Aug 2015 13:57:47 +0200 [thread overview]
Message-ID: <m2zj1kn9ac.fsf@krugs.de> (raw)
In-Reply-To: <87twrssyhy.fsf@iki.fi> (Jarmo Hurri's message of "Fri, 21 Aug 2015 13:54:17 +0300")
[-- Attachment #1: Type: text/plain, Size: 1843 bytes --]
Jarmo Hurri <jarmo.hurri@iki.fi> writes:
> Thomas S. Dye <tsd@tsdye.com> writes:
>
>> * Define a local variable
>> #+name: my-var
>> #+header: :exports none
>> #+begin_src R
>> 768
>> #+end_src
>> #+name: pass-my-var-to-code-block
>> #+header: :var x=my-var
>> #+header: :exports both
>> #+begin_src emacs-lisp
>> (+ x 1)
>> #+end_src
>>
>> #+results: pass-my-var-to-code-block
>> : 769
>>
>> The variable is call_my-var().
>
> Yeah, this will work, but it's a huge amount of work.
>
> It would be brilliant if one could easily refer to a property inside a
> subtree. In both text and code.
I agree - and I asked the same question some time (years?) ago.
But you could make this easier if you would use macro expansion and
to insert your value instead of the variable name - so
my-var is {{{my-var}}}
would be exported to
my-var is 769
Just don't ask me how to define the macro... - possibly
#+MACRO: my-var call_my-var()
?
Actually, I think it would be a cool if one could always use
{{{VARIABLE_NAME}}} and get the value of the variable VARIABLE_NAME back
to be inserted in text.
In other words, macro expansion would do the following:
1) Check if a macro is defined with the name, if yes, use that
2) if no macro is defined with this name, return the variable as string
3) if no variable is defined continue as usual
Cheers,
Rainer
>
> Jarmo
>
>
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)
Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa
Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax : +33 - (0)9 58 10 27 44
Fax (D): +49 - (0)3 21 21 25 22 44
email: Rainer@krugs.de
Skype: RMkrug
PGP: 0x0F52F982
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 480 bytes --]
next prev parent reply other threads:[~2015-08-21 11:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-20 6:39 Local variables in an org file Jarmo Hurri
2015-08-21 2:23 ` Grant Rettke
2015-08-21 2:52 ` Thomas S. Dye
2015-08-21 10:54 ` Jarmo Hurri
2015-08-21 11:57 ` Rainer M Krug [this message]
2015-08-21 17:08 ` Thomas S. Dye
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=m2zj1kn9ac.fsf@krugs.de \
--to=rainer@krugs.de \
--cc=emacs-orgmode@gnu.org \
--cc=jarmo.hurri@iki.fi \
/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).