From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?=22=C9ibhear=22?= Subject: Re: [PATCH] Prevent overwriting of output files from babel calls with nil result Date: Thu, 29 Oct 2015 17:31:10 -0000 Message-ID: <87f4f16f12829a921a198d2f05f1874b.squirrel@www.gibiris.org> References: <563000F7.3090409@gmail.com> <87si4tye5b.fsf@gmail.com> Reply-To: eibhear.geo@gmail.com Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zrr2h-0006f1-Ko for emacs-orgmode@gnu.org; Thu, 29 Oct 2015 13:31:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zrr2e-0000Bf-2x for emacs-orgmode@gnu.org; Thu, 29 Oct 2015 13:31:15 -0400 Received: from outbound-smtp05.blacknight.com ([81.17.249.38]:38463) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zrr2d-0000BB-Jy for emacs-orgmode@gnu.org; Thu, 29 Oct 2015 13:31:12 -0400 Received: from mail.blacknight.com (pemlinmail06.blacknight.ie [81.17.255.152]) by outbound-smtp05.blacknight.com (Postfix) with ESMTPS id 6A7D498BA2 for ; Thu, 29 Oct 2015 17:31:10 +0000 (UTC) In-Reply-To: <87si4tye5b.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: =?iso-8859-1?Q?=22=C9ibhear=22?= , Org Mode > Hi =C9ibhear, > > I'm afraid I don't understand the problem the patch is trying to fix. > Can you provide a MWE (minimal working example) that illustrates the bu= g > you're observing? > > Thanks, > > -- > Aaron Ecay > Hi Aaron, Thanks for getting back to me. Prerequisites: - The dot utility from graphvis is available - org-babel-load-languages includes '(dot . t) See below for a sample org file. For org-mode 8.2.10, invoking C-c C-c on the #+BEGIN_SRC line produces a file called sample-flow.png, representing a simple flow from a "Start" node to an "End" node. In org-mode 8.3.1 and 8.3.2, sample-flow.png contains only the text "nil"= . I believe the bug to be in `org-babel-execute:emacs-lisp', when the secon= d parameter to `org-babel-result-cond' is being evaluated. When `result' is nil, it is converted to "nil", and this is being written into the sample-flow.png file, overwriting the contents that the dot utility had created. My patch prevents a nil result being converted into a text string when calling `org-babel-result-cond'. I believe this is an appropriate change. =C9ibhear ---------------------->8=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D * Charts ** Chart from flows #+name: chart-from-flows #+HEADER: :var nodes=3Dsample-elements graph=3Dsample-connections ranks=3Dsample-ranks #+BEGIN_SRC emacs-lisp :file ./sample-flow.png :colnames yes :exports results (org-babel-execute:dot (concat "digraph {\n" "//rankdir=3DLR;\n" ;; remove comment characters '//' for horizontal layout; add for vertical layout (mapconcat (lambda (x) (format "%s [label=3D\"%s\" shape=3D%s style=3D\"filled\" fillcolor=3D\"%s\"]" (car x) (nth 1 x) (if (string=3D "" (nth 2 x)) "box" (nth 2 x)= ) (if (string=3D "" (nth 3 x)) "none" (nth 3 x= )) )) nodes "\n") "\n" (mapconcat (lambda (x) (format "%s -> %s [taillabel=3D\"%s\" color=3D\"%s\" style=3D= \"%s\"]" (car x) (nth 1 x) (nth 2 x) (if (string=3D "" (nth 3 x)) "black" (nth 3 = x)) (if (string=3D "" (nth 4 x)) "solid" (nth 4 = x)) )) graph "\n") "\n" (mapconcat (lambda (x) (format "{rank=3D%s %s}" (if (or (string=3D "min" (car x)) (string=3D "max" (car x))) (car x) (concat "same; " (car x))) (nth 1 x))) ranks "\n") "}\n") params) #+END_SRC #+RESULTS: chart-from-flows [[file:./sample-flow.png]] ** Development process flow *** Flow elements #+name: sample-elements | *node* | *label* | *shape* | *fillcolor* | |--------+---------+---------+-------------| | start | Start | ellipse | | | end | End | ellipse | | *** Flow connections #+name: sample-connections | from | to | label | colour | style | |-------+-----+-------+--------+-------| | start | end | | | | *** Flow ranks #+name: sample-ranks | anchor | node | |--------+-------| | min | start | | start | end | ---------------------->8=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D --=20 =C9ibhear =D3 hAnluain, Dublin, Ireland +-------------------------------+--------------------------------+ | e-mail: eibhear.geo@gmail.com | Web: [http://www.gibiris.org/] | | Twitter: @eibhear | Google+: +=C9ibhear =D3 hAnluain | | Mobile: +353 86 856 5666 | VoIP: sip:eibhear@linphone.org | +-------------------------------+--------------------------------+