emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] Prevent overwriting of output files from babel calls wit


From: Éibhear
Subject: Re: [O] [PATCH] Prevent overwriting of output files from babel calls with nil result
Date: Fri, 30 Oct 2015 23:41:13 +0000
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.8.0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 29/10/15 19:59, Aaron Ecay wrote:
> Hi Éibhear,
> 
> Thanks for sending the example.  I think it is not expected to
> work going forward because the lisp block relies on being able to
> pick up the value of ‘params’, which will not be possible now that
> org is moving to lexical binding.  In general,
> org-babel-execute:foo are internal functions, so trying to trick
> them int working properly in an elisp code block is a bad idea.
> 
> The emacs-lisp babel backend is special, so I can’t predict what
> the result would be of making it return the symbol nil instead of
> the string “nil.”  (Though for the sake of consistency it ought to
> allow nil symbol returns.)
> 
> On the balance, I recommend you do something like the following,
> using two code blocks (untested):
> 
> ,---- | #+name: dot-code | #+begin_src emacs-lisp :results
> verbatim | (generate-dot-code) | #+end_src | | #+RESULTS: dot-code 
> | : "your dot code will appear here" | | #+begin_src dot :file
> foo.png :var code=dot-code() | $code | #+end_src | | #+RESULTS: |
> [[file:foo.png]] `----
> 
> Hope this helps,
> 

Thanks Aaron.

The following works (":results raw" being the significant change):

,----
| #+name: dot-code
| #+begin_src emacs-lisp :results raw
| (generate-dot-code)
| #+end_src
|
| #+RESULTS: dot-code
|
| #+begin_src dot :file foo.png :var code=dot-code()
| $code
| #+end_src
|
| #+RESULTS:
| [[file:foo.png]]
`----

Éibhear

- -- 
Éibhear Ó hAnluain
Dublin, Ireland.
+-------------------------------+--------------------------------+
| e-mail: address@hidden | Web: [http://www.gibiris.org/] |
| Twitter: @eibhear             | Google+: +Éibhear Ó hAnluain   |
| Mobile: +353 86 856 5666      | VoIP: sip:address@hidden |
+-------------------------------+--------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlY0ABgACgkQ0ST+nPIXcQZUCgCgpDpWlO2u/D3yT6lMQ7DRO0j4
JV4An2O021+hm6DqwdUXLh8OFKEkUA3v
=+bEL
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]