From 8390a0aa545e046d0099b35f8b153e5c8d3dd4e6 Mon Sep 17 00:00:00 2001 From: jchkoch Date: Fri, 6 Jul 2018 19:54:48 -0600 Subject: [PATCH 1/2] added customizable variable to suppress execution count --- ob-ipython.el | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/ob-ipython.el b/ob-ipython.el index 043fb9a..a65e34b 100644 --- a/ob-ipython.el +++ b/ob-ipython.el @@ -64,6 +64,10 @@ "Directory where resources (e.g images) are stored so that they can be displayed.") +(defcustom ob-ipython-suppress-execution-count nil + "If non-nil do not show the execution count in output." + :group 'ob-ipython) + ;; utils (defun ob-ipython--write-string-to-file (file string) @@ -626,11 +630,13 @@ This function is called by `org-babel-execute-src-block'." output (ob-ipython--output output nil) (s-concat - (format "# Out[%d]:\n" (cdr (assoc :exec-count ret))) - (s-join "\n" (->> (-map (-partial 'ob-ipython--render file) - (list (cdr (assoc :value result)) - (cdr (assoc :display result)))) - (remove-if-not nil))))))) + (if ob-ipython-suppress-execution-count + "" + (format "# Out[%d]:\n" (cdr (assoc :exec-count ret))) + (s-join "\n" (->> (-map (-partial 'ob-ipython--render file) + (list (cdr (assoc :value result)) + (cdr (assoc :display result)))) + (remove-if-not nil))))))) (defun ob-ipython--render (file-or-nil values) (let ((org (lambda (value) value)) From 3d1bc7fcb089f0e734410068592e470fdc73bb42 Mon Sep 17 00:00:00 2001 From: jchkoch Date: Sun, 8 Jul 2018 22:14:53 -0600 Subject: [PATCH 2/2] added a missing bracket from previous commit --- ob-ipython.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ob-ipython.el b/ob-ipython.el index a65e34b..e004011 100644 --- a/ob-ipython.el +++ b/ob-ipython.el @@ -636,7 +636,7 @@ This function is called by `org-babel-execute-src-block'." (s-join "\n" (->> (-map (-partial 'ob-ipython--render file) (list (cdr (assoc :value result)) (cdr (assoc :display result)))) - (remove-if-not nil))))))) + (remove-if-not nil)))))))) (defun ob-ipython--render (file-or-nil values) (let ((org (lambda (value) value))