From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?B?w4lpYmhlYXI=?= Subject: Re: [PATCH] Prevent overwriting of output files from babel calls with nil result Date: Fri, 30 Oct 2015 23:41:13 +0000 Message-ID: <56340019.8020904@gmail.com> References: <563000F7.3090409@gmail.com> <87si4tye5b.fsf@gmail.com> <87f4f16f12829a921a198d2f05f1874b.squirrel@www.gibiris.org> <87ziz1wim9.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57569) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZsJHx-00028j-9k for emacs-orgmode@gnu.org; Fri, 30 Oct 2015 19:40:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZsJHu-0006TJ-3x for emacs-orgmode@gnu.org; Fri, 30 Oct 2015 19:40:53 -0400 Received: from mail-wi0-x22b.google.com ([2a00:1450:400c:c05::22b]:37477) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZsJHt-0006TC-Ut for emacs-orgmode@gnu.org; Fri, 30 Oct 2015 19:40:50 -0400 Received: by wicfv8 with SMTP id fv8so20011312wic.0 for ; Fri, 30 Oct 2015 16:40:49 -0700 (PDT) In-Reply-To: <87ziz1wim9.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: aaronecay@gmail.com, Org Mode -----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-----