emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] ob-scheme.el: Fix scheme blocks ignoring :results in formatting
@ 2018-06-20 19:36 Henry Blevins
  2018-06-21 16:16 ` Nicolas Goaziou
  2018-06-21 17:56 ` Neil Jerram
  0 siblings, 2 replies; 6+ messages in thread
From: Henry Blevins @ 2018-06-20 19:36 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 325 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 465 bytes --]

[-- Attachment #2: 0001-ob-scheme.el-Fix-scheme-blocks-ignoring-results-in-f.patch --]
[-- Type: text/x-patch, Size: 1952 bytes --]

From f93f086cbb16926c883a31fe8ad796e0da8bc8f7 Mon Sep 17 00:00:00 2001
From: Henry Blevins <heblevi@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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-06-21 20:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-20 19:36 [PATCH] ob-scheme.el: Fix scheme blocks ignoring :results in formatting Henry Blevins
2018-06-21 16:16 ` Nicolas Goaziou
2018-06-21 19:05   ` Henry Blevins
2018-06-21 20:02     ` Nicolas Goaziou
2018-06-21 17:56 ` Neil Jerram
2018-06-21 18:44   ` Henry Blevins

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).