Currently, scheme babel blocks ignore :results header arguments like
'verbatim' and attempt to format all output as tables. This patch corrects
that and performs the user supplied formatting.

This is my first time contributing a patch, so I apologize if I have made
any mistakes in submitting this.

Regards,

Henry Blevins
From f93f086cbb16926c883a31fe8ad796e0da8bc8f7 Mon Sep 17 00:00:00 2001
From: Henry Blevins <hebl...@gmail.com>
Date: Wed, 20 Jun 2018 14:38:47 -0400
Subject: [PATCH] ob-scheme.el: Fix scheme blocks ignoring :results in
 formatting

* ob-scheme.el (org-babel-execute:scheme): Process the :result header
argument to conditionally and appropriately format output.

Currently, `org-babel-execute:scheme' ignores the user specified :result header
argument found in the :result-param parameter and process all output as a table.
The fix is to pass the `result' and :result-param to the `org-babel-result-cond'
function to invoke the corresponding formatting.

For example, the following block incorrectly formats its output as a table:

(list 1 2 3)

| 1 | 2 | 3 |

This patch results in the correct behavior:

(list 1 2 3)

: (1 2 3)

Bringing it inline with the result using Emacs lisp:

(list 1 2 3)

: (1 2 3)
---
 lisp/ob-scheme.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el
index 0abac7462..fb7c48bbc 100644
--- a/lisp/ob-scheme.el
+++ b/lisp/ob-scheme.el
@@ -212,6 +212,7 @@ This function is called by `org-babel-execute-src-block'"
 	     (session (org-babel-scheme-make-session-name
 		       source-buffer-name (cdr (assq :session params)) impl))
 	     (full-body (org-babel-expand-body:scheme body params))
+	     (result-params (cdr (assq :result-params params)))
 	     (result
 	      (org-babel-scheme-execute-with-geiser
 	       full-body		       ; code
@@ -225,7 +226,9 @@ This function is called by `org-babel-execute-src-block'"
 				     (cdr (assq :colnames params)))
 		(org-babel-pick-name (cdr (assq :rowname-names params))
 				     (cdr (assq :rownames params))))))
-	  (org-babel-scheme--table-or-string table))))))
+	  (org-babel-result-cond result-params
+	    result
+	    (org-babel-scheme--table-or-string table)))))))
 
 (provide 'ob-scheme)
 
-- 
2.17.0

Reply via email to