emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* #+header: :post -> Symbol's value as variable is void: *this*
@ 2014-07-26 20:02 Thorsten Jolitz
  2014-07-27  7:27 ` Thorsten Jolitz
  0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Jolitz @ 2014-07-26 20:02 UTC (permalink / raw)
  To: emacs-orgmode


Hi List, 

whats wrong with this :post header arg:

#+header: :post (format "#+attr_latex :float :placement {c}{scale=.6}\n%s" *this*) 
#+begin_src emacs-lisp 
 (+ 2 2)
#+end_src

When I understand 

,----
| http://orgmode.org/manual/post.html
`----

correctly, *this* should hold the block results, but I get 

,----
| Symbol's value as variable is void: *this*
`----

-- 
cheers,
Thorsten

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

* Re: #+header: :post -> Symbol's value as variable is void: *this*
  2014-07-26 20:02 #+header: :post -> Symbol's value as variable is void: *this* Thorsten Jolitz
@ 2014-07-27  7:27 ` Thorsten Jolitz
  2014-08-06  4:12   ` Aaron Ecay
  0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Jolitz @ 2014-07-27  7:27 UTC (permalink / raw)
  To: emacs-orgmode

Thorsten Jolitz <tjolitz@gmail.com> writes:

> Hi List, 
>
> whats wrong with this :post header arg:
>
> #+header: :post (format "#+attr_latex :float :placement {c}{scale=.6}\n%s" *this*) 
> #+begin_src emacs-lisp 
>  (+ 2 2)
> #+end_src
>
> When I understand 
>
> ,----
> | http://orgmode.org/manual/post.html
> `----
>
> correctly, *this* should hold the block results, but I get 
>
> ,----
> | Symbol's value as variable is void: *this*
> `----


This works:

#+name: myconcat
#+header: :var x=""
#+begin_src emacs-lisp
 (format "Do %sx then quit" x)
#+end_src


#+header: :post myconcat(x=*this*)
#+begin_src emacs-lisp 
 (+ 2 2)
#+end_src

#+results:
: Do 4x then quit


but how do I interpret the following sentence from the manual:

,----
| This variable [*this*] may then be included in header argument forms
| such as those used in var header argument specifications allowing
| passing of results to other code blocks, or direct execution via Emacs
| Lisp.
`----

What is meant by 'direct execution via Emacs Lisp' here? I think the
above construct with two src-blocks is a bit heavy for the rather small
task and hoped I could just give an Emacs Lisp expression containing
*this* as value to the :post header arg, but apparently not?

#+header: :post (format "Do %sx then quit" *this*)
#+begin_src emacs-lisp 
 (+ 2 2)
#+end_src

-> eval: Symbol's value as variable is void: *this*

-- 
cheers,
Thorsten

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

* Re: #+header: :post -> Symbol's value as variable is void: *this*
  2014-07-27  7:27 ` Thorsten Jolitz
@ 2014-08-06  4:12   ` Aaron Ecay
  2014-08-06  8:54     ` Thorsten Jolitz
  0 siblings, 1 reply; 4+ messages in thread
From: Aaron Ecay @ 2014-08-06  4:12 UTC (permalink / raw)
  To: Thorsten Jolitz, emacs-orgmode

Hi Thorsten,

2014ko uztailak 27an, Thorsten Jolitz-ek idatzi zuen:
> 
> Thorsten Jolitz <tjolitz@gmail.com> writes:
> 
>> Hi List, 
>> 
>> whats wrong with this :post header arg:
>> 
>> #+header: :post (format "#+attr_latex :float :placement {c}{scale=.6}\n%s" *this*) 
>> #+begin_src emacs-lisp 
>> (+ 2 2)
>> #+end_src
>> 
>> When I understand 
>> 
>> ,----
>> | http://orgmode.org/manual/post.html
>> `----
>> 
>> correctly, *this* should hold the block results, but I get 
>> 
>> ,----
>> | Symbol's value as variable is void: *this*
>> `----
> 
> 
> This works:
> 
> #+name: myconcat
> #+header: :var x=""
> #+begin_src emacs-lisp
>  (format "Do %sx then quit" x)
> #+end_src
> 
> 
> #+header: :post myconcat(x=*this*)
> #+begin_src emacs-lisp 
>  (+ 2 2)
> #+end_src
> 
> #+results:
> : Do 4x then quit
> 
> 
> but how do I interpret the following sentence from the manual:
> 
> ,----
> | This variable [*this*] may then be included in header argument forms
> | such as those used in var header argument specifications allowing
> | passing of results to other code blocks, or direct execution via Emacs
> | Lisp.
> `----
> 
> What is meant by 'direct execution via Emacs Lisp' here? I think the
> above construct with two src-blocks is a bit heavy for the rather small
> task and hoped I could just give an Emacs Lisp expression containing
> *this* as value to the :post header arg, but apparently not?
> 
> #+header: :post (format "Do %sx then quit" *this*)
> #+begin_src emacs-lisp 
>  (+ 2 2)
> #+end_src
> 
> -> eval: Symbol's value as variable is void: *this*

The value of :post should be a babel call (in the same format as e.g. a
#+call line), not an elisp form.  If babel sees something that looks
like elisp, it will attempt to ‘eval’ it when parsing the src block,
before *this* is bound (which happens only upon execution, after
parsing).

-- 
Aaron Ecay

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

* Re: #+header: :post -> Symbol's value as variable is void: *this*
  2014-08-06  4:12   ` Aaron Ecay
@ 2014-08-06  8:54     ` Thorsten Jolitz
  0 siblings, 0 replies; 4+ messages in thread
From: Thorsten Jolitz @ 2014-08-06  8:54 UTC (permalink / raw)
  To: emacs-orgmode

Aaron Ecay <aaronecay@gmail.com> writes:

Hi Aaron,

> 2014ko uztailak 27an, Thorsten Jolitz-ek idatzi zuen:
>> 
>> Thorsten Jolitz <tjolitz@gmail.com> writes:
>> 
>>> Hi List, 
>>> 
>>> whats wrong with this :post header arg:
>>> 
>>> #+header: :post (format "#+attr_latex :float :placement
>>> {c}{scale=.6}\n%s" *this*)
>>> #+begin_src emacs-lisp 
>>> (+ 2 2)
>>> #+end_src
>>> 
>>> When I understand 
>>> 
>>> ,----
>>> | http://orgmode.org/manual/post.html
>>> `----
>>> 
>>> correctly, *this* should hold the block results, but I get 
>>> 
>>> ,----
>>> | Symbol's value as variable is void: *this*
>>> `----
>> 
>> 
>> This works:
>> 
>> #+name: myconcat
>> #+header: :var x=""
>> #+begin_src emacs-lisp
>>  (format "Do %sx then quit" x)
>> #+end_src
>> 
>> 
>> #+header: :post myconcat(x=*this*)
>> #+begin_src emacs-lisp 
>>  (+ 2 2)
>> #+end_src
>> 
>> #+results:
>> : Do 4x then quit
>> 
>> 
>> but how do I interpret the following sentence from the manual:
>> 
>> ,----
>> | This variable [*this*] may then be included in header argument forms
>> | such as those used in var header argument specifications allowing
>> | passing of results to other code blocks, or direct execution via Emacs
>> | Lisp.
>> `----
>> 
>> What is meant by 'direct execution via Emacs Lisp' here? I think the
>> above construct with two src-blocks is a bit heavy for the rather small
>> task and hoped I could just give an Emacs Lisp expression containing
>> *this* as value to the :post header arg, but apparently not?
>> 
>> #+header: :post (format "Do %sx then quit" *this*)
>> #+begin_src emacs-lisp 
>>  (+ 2 2)
>> #+end_src
>> 
>> -> eval: Symbol's value as variable is void: *this*
>
> The value of :post should be a babel call (in the same format as e.g. a
> #+call line), not an elisp form.  If babel sees something that looks
> like elisp, it will attempt to ‘eval’ it when parsing the src block,
> before *this* is bound (which happens only upon execution, after
> parsing).

Thats 

 #+CALL: <name>(<arguments>)

then, and looks like the headerline of the working example above:

#+header: :post myconcat(x=*this*)

Then there is no way to achieve what I had in mind. Thx. 

-- 
cheers,
Thorsten

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

end of thread, other threads:[~2014-08-06  8:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-26 20:02 #+header: :post -> Symbol's value as variable is void: *this* Thorsten Jolitz
2014-07-27  7:27 ` Thorsten Jolitz
2014-08-06  4:12   ` Aaron Ecay
2014-08-06  8:54     ` Thorsten Jolitz

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