emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Éibhear <eibhear.geo@gmail.com>
To: aaronecay@gmail.com, Org Mode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] Prevent overwriting of output files from babel calls with nil result
Date: Fri, 30 Oct 2015 23:41:13 +0000	[thread overview]
Message-ID: <56340019.8020904@gmail.com> (raw)
In-Reply-To: <87ziz1wim9.fsf@gmail.com>

-----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: eibhear.geo@gmail.com | Web: [http://www.gibiris.org/] |
| Twitter: @eibhear             | Google+: +Éibhear Ó hAnluain   |
| Mobile: +353 86 856 5666      | VoIP: sip:eibhear@linphone.org |
+-------------------------------+--------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

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

  reply	other threads:[~2015-10-30 23:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-27 22:55 [PATCH] Prevent overwriting of output files from babel calls with nil result Éibhear
2015-10-29 13:53 ` Aaron Ecay
2015-10-29 17:31   ` "Éibhear"
2015-10-29 19:59     ` Aaron Ecay
2015-10-30 23:41       ` Éibhear [this message]
2015-11-04 10:59         ` Aaron Ecay

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=56340019.8020904@gmail.com \
    --to=eibhear.geo@gmail.com \
    --cc=aaronecay@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).