emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* "global" variables in a babel document...
@ 2016-05-17 19:24 Allen S. Rout
  2016-05-18 16:50 ` Nicolas Goaziou
  2016-05-19  8:55 ` Miguel Ruiz
  0 siblings, 2 replies; 3+ messages in thread
From: Allen S. Rout @ 2016-05-17 19:24 UTC (permalink / raw)
  To: emacs-orgmode

org-version
org "8.2.10"
emacs-version
"24.5.1"


I'm seeing what seems to be some inconsistent treatment of :var header
args.  Or maybe I'm just missing something.   I'm trying to follow:

http://orgmode.org/manual/Header-arguments-in-Org-mode-properties.html#Header-arguments-in-Org-mode-properties

and I find that the local :var works (of course) and the outline level
one also works, but the document-level one does not.

Minimal example, with my results, below.

I'm wondering if I'm thinking about the problem wrong.  What I'm trying
to accomplish is setting, at a document level, a few variables which I
would like to be accessible in every code block in this document.

I know I can set them independently on every block, but that seems
tiresome.


- Allen S. Rout

-----
#+PROPERTY:header-args    :var tsmuser="query"

* foo
 :PROPERTIES:
 :header-args: :var tsmpass="query"
 :END:

#+name: toy
#+begin_src sh :var bloop="foo"
echo sss ${bloop} ddd
echo sss ${tsmpass} ddd
echo sss ${tsmuser} ddd
#+end_src

#+RESULTS: toy
| sss | foo   | ddd |
| sss | query | ddd |
| sss | ddd   |     |
-----

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

* Re: "global" variables in a babel document...
  2016-05-17 19:24 "global" variables in a babel document Allen S. Rout
@ 2016-05-18 16:50 ` Nicolas Goaziou
  2016-05-19  8:55 ` Miguel Ruiz
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Goaziou @ 2016-05-18 16:50 UTC (permalink / raw)
  To: Allen S. Rout; +Cc: emacs-orgmode

Hello,

"Allen S. Rout" <asr@ufl.edu> writes:

> #+PROPERTY:header-args    :var tsmuser="query"

It should be #+PROPERTY: header-args :var tsmuser="query"

Regards,

-- 
Nicolas Goaziou

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

* Re: "global" variables in a babel document...
  2016-05-17 19:24 "global" variables in a babel document Allen S. Rout
  2016-05-18 16:50 ` Nicolas Goaziou
@ 2016-05-19  8:55 ` Miguel Ruiz
  1 sibling, 0 replies; 3+ messages in thread
From: Miguel Ruiz @ 2016-05-19  8:55 UTC (permalink / raw)
  To: Allen S. Rout, Emacs Orgmode

This works for me, but if you change tsmuser value in session, you have 
to C-c C-c in PROPERTY line, getting "Local setup have been refreshed".

#+PROPERTY: var tsmuser="query"

* foo
  :PROPERTIES:
  :header-args: :var tsmpass="query"
  :END:

#+name: toy
#+begin_src sh :var bloop="foo"
echo sss ${bloop} ddd
echo sss ${tsmpass} ddd
echo sss ${tsmuser} ddd
#+end_src

#+RESULTS: toy
| sss | foo   | ddd |
| sss | query | ddd |
| sss | query | ddd |


Best regards.

El 2016-05-17 21:24, Allen S. Rout escribió:
> org-version
> org "8.2.10"
> emacs-version
> "24.5.1"
> 
> 
> I'm seeing what seems to be some inconsistent treatment of :var header
> args.  Or maybe I'm just missing something.   I'm trying to follow:
> 
> http://orgmode.org/manual/Header-arguments-in-Org-mode-properties.html#Header-arguments-in-Org-mode-properties
> 
> and I find that the local :var works (of course) and the outline level
> one also works, but the document-level one does not.
> 
> Minimal example, with my results, below.
> 
> I'm wondering if I'm thinking about the problem wrong.  What I'm trying
> to accomplish is setting, at a document level, a few variables which I
> would like to be accessible in every code block in this document.
> 
> I know I can set them independently on every block, but that seems
> tiresome.
> 
> 
> - Allen S. Rout
> 
> -----
> #+PROPERTY:header-args    :var tsmuser="query"
> 
> * foo
>  :PROPERTIES:
>  :header-args: :var tsmpass="query"
>  :END:
> 
> #+name: toy
> #+begin_src sh :var bloop="foo"
> echo sss ${bloop} ddd
> echo sss ${tsmpass} ddd
> echo sss ${tsmuser} ddd
> #+end_src
> 
> #+RESULTS: toy
> | sss | foo   | ddd |
> | sss | query | ddd |
> | sss | ddd   |     |
> -----

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

end of thread, other threads:[~2016-05-19  8:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-17 19:24 "global" variables in a babel document Allen S. Rout
2016-05-18 16:50 ` Nicolas Goaziou
2016-05-19  8:55 ` Miguel Ruiz

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