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

Hi,

Here's a patch to ob-emacs-lisp.el to allow me to start generating
graphs with dot again.

Thanks,

Éibhear

- -- 
Éibhear Ó hAnluain
Dublin, Ireland.
+-------------------------------+--------------------------------+
| e-mail: eibhear....@gmail.com | Web: [http://www.gibiris.org/] |
| Twitter: @eibhear             | Google+: +Éibhear Ó hAnluain   |
| Mobile: +353 86 856 5666      | VoIP: sip:eibh...@linphone.org |
+-------------------------------+--------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEARECAAYFAlYwAPcACgkQ0ST+nPIXcQb+7QCbB9M8FNYMQM/AO9Sy57vMyjdD
TsMAn0KiaebLDLAxcbQX7OmuQvULwQ42
=wDzV
-----END PGP SIGNATURE-----
>From a25cd4da8791ff9bb759ba38c05ff07650555055 Mon Sep 17 00:00:00 2001
From: Eibhear O hAnluain <eibhear....@gmail.com>
Date: Tue, 27 Oct 2015 22:43:02 +0000
Subject: [PATCH] ob-emacs-lisp.el: Don't convert a nil result to "nil"

* ob-emacs-lisp.el (org-babel-execute:emacs-lisp): if `result' is nil
  after the execution of the emacs-lisp code, then it should be passed
  to `ob-babel-result-cond' as nil, and not converted to "nil".

When successful, `org-babel-execute:dot' returns nil, as the output is
written to a file.  Commit 041ca4b6f4c7fe1a7e7eb22e2f08ec2e08577bf9
causes the macro `org-babel-result-cond' to overwrite the file and
populate it with the text "nil". This is because the nil `result' from
the call to the emacs-lisp code is converted to "nil" in
`org-babel-execute:emacs-lisp' when calling `org-babel-result-cond'.
This patch preserves `result' as nil.

TINYCHANGE
---
 lisp/ob-emacs-lisp.el | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lisp/ob-emacs-lisp.el b/lisp/ob-emacs-lisp.el
index 796293b..bbd3dc8 100644
--- a/lisp/ob-emacs-lisp.el
+++ b/lisp/ob-emacs-lisp.el
@@ -59,12 +59,14 @@
                                (org-babel-expand-body:emacs-lisp
                                 body params))))))
       (org-babel-result-cond (cdr (assoc :result-params params))
-	(let ((print-level nil)
-              (print-length nil))
-          (if (or (member "scalar" (cdr (assoc :result-params params)))
-                  (member "verbatim" (cdr (assoc :result-params params))))
-              (format "%S" result)
-            (format "%s" result)))
+	(if result
+	    (let ((print-level nil)
+		  (print-length nil))
+	      (if (or (member "scalar" (cdr (assoc :result-params params)))
+		      (member "verbatim" (cdr (assoc :result-params params))))
+		  (format "%S" result)
+		(format "%s" result)))
+	  )
 	(org-babel-reassemble-table
 	 result
          (org-babel-pick-name (cdr (assoc :colname-names params))
-- 
2.1.4

Reply via email to