emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Enhance Org babel scheme
@ 2017-07-16 17:08 "José L. Doménech"
  2017-07-17 17:55 ` [PATCH] An amended to the enhance Org babel for scheme blocks "José L. Doménech"
  0 siblings, 1 reply; 6+ messages in thread
From: "José L. Doménech" @ 2017-07-16 17:08 UTC (permalink / raw)
  To: "José Luis Doménech Martínez"; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 712 bytes --]

Hello, I have modified 'ob-scheme.el' to be able to return org tables.

This is a quick patch. I hope you find it useful buut I could modify,
document or write test for it if necesary.

I have already assigned the copyright for Emacs to the FSF.


Enhance the scheme babel block output.

Allow scheme code blocks to return a table.

* lisp/ob-scheme.el (org-babel-scheme-null-to): New custom option that
  allows to use a empty list to format the table output, initially assigned
  to 'hlines.
  (org-babel-scheme-table-or-string): New helper function to convert the
  return value from the block as a table or a string.
  (org-babel-execute-src-block): Changed to allow the return of a table for
  the output.


[-- Attachment #2: ob-scheme.el.diff --]
[-- Type: text/plain, Size: 3043 bytes --]

1 file changed, 35 insertions(+), 11 deletions(-)
lisp/ob-scheme.el | 46 +++++++++++++++++++++++++++++++++++-----------

modified   lisp/ob-scheme.el
@@ -51,6 +51,13 @@
                   (start end &optional and-go raw nomsg))
 (declare-function geiser-repl-exit "ext:geiser-repl" (&optional arg))
 
+(defcustom org-babel-scheme-null-to 'hline
+  "Replace `null' in scheme tables with this before returning."
+  :group 'org-babel
+  :version "24.4"
+  :package-version '(Org . "8.0")
+  :type 'symbol)
+
 (defvar org-babel-default-header-args:scheme '()
   "Default header arguments for scheme code blocks.")
 
@@ -176,6 +183,18 @@ is true; otherwise returns the last value."
 		       result))))
     result))
 
+(defun org-babel-scheme-table-or-string (results)
+  "Convert RESULTS into an appropriate elisp value.
+If the results look like a list or tuple, then convert them into an
+Emacs-lisp table, otherwise return the results as a string."
+  (let ((res (org-babel-script-escape results)))
+    (if (listp res)
+        (mapcar (lambda (el) (if (or (eq el '()) (eq el 'null))
+				 org-babel-scheme-null-to
+			       el))
+                res)
+      res)))
+
 (defun org-babel-execute:scheme (body params)
   "Execute a block of Scheme code with org-babel.
 This function is called by `org-babel-execute-src-block'"
@@ -184,7 +203,6 @@ This function is called by `org-babel-execute-src-block'"
 			      "^ ?\\*\\([^*]+\\)\\*" "\\1"
 			      (buffer-name source-buffer))))
     (save-excursion
-      (org-babel-reassemble-table
        (let* ((result-type (cdr (assq :result-type params)))
 	      (impl (or (when (cdr (assq :scheme params))
 			  (intern (cdr (assq :scheme params))))
@@ -192,16 +210,22 @@ This function is called by `org-babel-execute-src-block'"
 			(car geiser-active-implementations)))
 	      (session (org-babel-scheme-make-session-name
 			source-buffer-name (cdr (assq :session params)) impl))
-	      (full-body (org-babel-expand-body:scheme body params)))
-	 (org-babel-scheme-execute-with-geiser
-	  full-body			 ; code
-	  (string= result-type "output") ; output?
-	  impl				 ; implementation
-	  (and (not (string= session "none")) session))) ; session
-       (org-babel-pick-name (cdr (assq :colname-names params))
-			    (cdr (assq :colnames params)))
-       (org-babel-pick-name (cdr (assq :rowname-names params))
-			    (cdr (assq :rownames params)))))))
+	      (full-body (org-babel-expand-body:scheme body params))
+	      (result
+	       (org-babel-scheme-execute-with-geiser
+		full-body			 ; code
+		(string= result-type "output")   ; output?
+		impl				 ; implementation
+		(and (not (string= session "none")) session))) ; session
+	      )
+	 (let ((table
+		(org-babel-reassemble-table
+		 result
+		 (org-babel-pick-name (cdr (assq :colname-names params))
+				      (cdr (assq :colnames params)))
+		 (org-babel-pick-name (cdr (assq :rowname-names params))
+				      (cdr (assq :rownames params))))))
+	   (org-babel-scheme-table-or-string table))))))
 
 (provide 'ob-scheme)
 

[-- Attachment #3: Type: text/plain, Size: 37 bytes --]



Best regards:

José L. Doménech

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

* [PATCH] An amended to the enhance Org babel for scheme blocks
  2017-07-16 17:08 Enhance Org babel scheme "José L. Doménech"
@ 2017-07-17 17:55 ` "José L. Doménech"
  2017-07-23  9:32   ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: "José L. Doménech" @ 2017-07-17 17:55 UTC (permalink / raw)
  To: "José Luis Doménech Martínez"; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 916 bytes --]

Hello again, I have added a :prologue param to the scheme blocks of babel.
This multiple option prepends all the values in the generated code of the
block.

This patch also includes the previous one that enabled returning a table
when evaluating a scheme block.

A changelog:

Enhance the babel block for scheme.

Allows scheme code blocks to return a table and add a :prologue param
to the scheme blocks. All :prologue params are prepended to the
body of code.

* lisp/ob-scheme.el (org-babel-scheme-null-to): New custom option that
  allows to use a empty list to format the table output, initially
  assigned to 'hlines.
  (org-babel-scheme-table-or-string): New helper function to convert
  the return value from the block as a table or a string.
  (org-babel-execute-src-block): Changed to allow the return of a
  table for the output.
  (org-babel-expand-body:scheme) Add :prologue param support.

The patch:


[-- Attachment #2: 0001-Enhance-the-babel-block-for-scheme.patch --]
[-- Type: text/plain, Size: 4588 bytes --]

From c87786bc4b4d40cdda99a7fb006382c8a852928a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Dom=C3=A9nech?= <domenechjosel@gmail.com>
Date: Mon, 17 Jul 2017 08:42:32 +0200
Subject: [PATCH] Enhance the babel block for scheme.

Allows scheme code blocks to return a table and add a :prologue param
to the scheme blocks. All :prologue params are prepended to the
body of code.

* lisp/ob-scheme.el (org-babel-scheme-null-to): New custom option that
  allows to use a empty list to format the table output, initially
  assigned to 'hlines.
  (org-babel-scheme-table-or-string): New helper function to convert
  the return value from the block as a table or a string.
  (org-babel-execute-src-block): Changed to allow the return of a
  table for the output.
  (org-babel-expand-body:scheme) Add :prologue param support.
---
 lisp/ob-scheme.el | 53 ++++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 40 insertions(+), 13 deletions(-)

diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el
index cd8c386..599ece7 100644
--- a/lisp/ob-scheme.el
+++ b/lisp/ob-scheme.el
@@ -51,14 +51,24 @@
                   (start end &optional and-go raw nomsg))
 (declare-function geiser-repl-exit "ext:geiser-repl" (&optional arg))
 
+(defcustom org-babel-scheme-null-to 'hline
+  "Replace `null' in scheme tables with this before returning."
+  :group 'org-babel
+  :version "24.4"
+  :package-version '(Org . "8.0")
+  :type 'symbol)
+
 (defvar org-babel-default-header-args:scheme '()
   "Default header arguments for scheme code blocks.")
 
 (defun org-babel-expand-body:scheme (body params)
   "Expand BODY according to PARAMS, return the expanded body."
-  (let ((vars (org-babel--get-vars params)))
+  (let ((vars (org-babel--get-vars params))
+	(prepends (cl-remove-if-not (lambda (x) (eq (car x) :prologue)) params)))
     (if (> (length vars) 0)
-        (concat "(let ("
+        (concat (mapconcat (lambda (p) (format "%s" (cdr p)))
+			   prepends "\n     ")
+	        "(let ("
                 (mapconcat
                  (lambda (var) (format "%S" (print `(,(car var) ',(cdr var)))))
                  vars "\n      ")
@@ -176,6 +186,18 @@ is true; otherwise returns the last value."
 		       result))))
     result))
 
+(defun org-babel-scheme-table-or-string (results)
+  "Convert RESULTS into an appropriate elisp value.
+If the results look like a list or tuple, then convert them into an
+Emacs-lisp table, otherwise return the results as a string."
+  (let ((res (org-babel-script-escape results)))
+    (if (listp res)
+        (mapcar (lambda (el) (if (or (eq el '()) (eq el 'null))
+				 org-babel-scheme-null-to
+			       el))
+                res)
+      res)))
+
 (defun org-babel-execute:scheme (body params)
   "Execute a block of Scheme code with org-babel.
 This function is called by `org-babel-execute-src-block'"
@@ -184,7 +206,6 @@ This function is called by `org-babel-execute-src-block'"
 			      "^ ?\\*\\([^*]+\\)\\*" "\\1"
 			      (buffer-name source-buffer))))
     (save-excursion
-      (org-babel-reassemble-table
        (let* ((result-type (cdr (assq :result-type params)))
 	      (impl (or (when (cdr (assq :scheme params))
 			  (intern (cdr (assq :scheme params))))
@@ -192,16 +213,22 @@ This function is called by `org-babel-execute-src-block'"
 			(car geiser-active-implementations)))
 	      (session (org-babel-scheme-make-session-name
 			source-buffer-name (cdr (assq :session params)) impl))
-	      (full-body (org-babel-expand-body:scheme body params)))
-	 (org-babel-scheme-execute-with-geiser
-	  full-body			 ; code
-	  (string= result-type "output") ; output?
-	  impl				 ; implementation
-	  (and (not (string= session "none")) session))) ; session
-       (org-babel-pick-name (cdr (assq :colname-names params))
-			    (cdr (assq :colnames params)))
-       (org-babel-pick-name (cdr (assq :rowname-names params))
-			    (cdr (assq :rownames params)))))))
+	      (full-body (org-babel-expand-body:scheme body params))
+	      (result
+	       (org-babel-scheme-execute-with-geiser
+		full-body			 ; code
+		(string= result-type "output")   ; output?
+		impl				 ; implementation
+		(and (not (string= session "none")) session))) ; session
+	      )
+	 (let ((table
+		(org-babel-reassemble-table
+		 result
+		 (org-babel-pick-name (cdr (assq :colname-names params))
+				      (cdr (assq :colnames params)))
+		 (org-babel-pick-name (cdr (assq :rowname-names params))
+				      (cdr (assq :rownames params))))))
+	   (org-babel-scheme-table-or-string table))))))
 
 (provide 'ob-scheme)
 
-- 
2.7.4


[-- Attachment #3: Type: text/plain, Size: 4375 bytes --]


I hope it will be useful for someone.

José L. Doménech

On Sun, 16 Jul 2017 19:08:02 +0200,
José L. Doménech wrote:
> 
> [1  <text/plain; US-ASCII (7bit)>]
> Hello, I have modified 'ob-scheme.el' to be able to return org tables.
> 
> This is a quick patch. I hope you find it useful buut I could modify,
> document or write test for it if necesary.
> 
> I have already assigned the copyright for Emacs to the FSF.
> 
> 
> Enhance the scheme babel block output.
> 
> Allow scheme code blocks to return a table.
> 
> * lisp/ob-scheme.el (org-babel-scheme-null-to): New custom option that
>   allows to use a empty list to format the table output, initially assigned
>   to 'hlines.
>   (org-babel-scheme-table-or-string): New helper function to convert the
>   return value from the block as a table or a string.
>   (org-babel-execute-src-block): Changed to allow the return of a table for
>   the output.
> 
> [2 ob-scheme.el.diff <text/plain; US-ASCII (base64)>]
> 1 file changed, 35 insertions(+), 11 deletions(-)
> lisp/ob-scheme.el | 46 +++++++++++++++++++++++++++++++++++-----------
> 
> modified   lisp/ob-scheme.el
> @@ -51,6 +51,13 @@
>                    (start end &optional and-go raw nomsg))
>  (declare-function geiser-repl-exit "ext:geiser-repl" (&optional arg))
>  
> +(defcustom org-babel-scheme-null-to 'hline
> +  "Replace `null' in scheme tables with this before returning."
> +  :group 'org-babel
> +  :version "24.4"
> +  :package-version '(Org . "8.0")
> +  :type 'symbol)
> +
>  (defvar org-babel-default-header-args:scheme '()
>    "Default header arguments for scheme code blocks.")
>  
> @@ -176,6 +183,18 @@ is true; otherwise returns the last value."
>  		       result))))
>      result))
>  
> +(defun org-babel-scheme-table-or-string (results)
> +  "Convert RESULTS into an appropriate elisp value.
> +If the results look like a list or tuple, then convert them into an
> +Emacs-lisp table, otherwise return the results as a string."
> +  (let ((res (org-babel-script-escape results)))
> +    (if (listp res)
> +        (mapcar (lambda (el) (if (or (eq el '()) (eq el 'null))
> +				 org-babel-scheme-null-to
> +			       el))
> +                res)
> +      res)))
> +
>  (defun org-babel-execute:scheme (body params)
>    "Execute a block of Scheme code with org-babel.
>  This function is called by `org-babel-execute-src-block'"
> @@ -184,7 +203,6 @@ This function is called by `org-babel-execute-src-block'"
>  			      "^ ?\\*\\([^*]+\\)\\*" "\\1"
>  			      (buffer-name source-buffer))))
>      (save-excursion
> -      (org-babel-reassemble-table
>         (let* ((result-type (cdr (assq :result-type params)))
>  	      (impl (or (when (cdr (assq :scheme params))
>  			  (intern (cdr (assq :scheme params))))
> @@ -192,16 +210,22 @@ This function is called by `org-babel-execute-src-block'"
>  			(car geiser-active-implementations)))
>  	      (session (org-babel-scheme-make-session-name
>  			source-buffer-name (cdr (assq :session params)) impl))
> -	      (full-body (org-babel-expand-body:scheme body params)))
> -	 (org-babel-scheme-execute-with-geiser
> -	  full-body			 ; code
> -	  (string= result-type "output") ; output?
> -	  impl				 ; implementation
> -	  (and (not (string= session "none")) session))) ; session
> -       (org-babel-pick-name (cdr (assq :colname-names params))
> -			    (cdr (assq :colnames params)))
> -       (org-babel-pick-name (cdr (assq :rowname-names params))
> -			    (cdr (assq :rownames params)))))))
> +	      (full-body (org-babel-expand-body:scheme body params))
> +	      (result
> +	       (org-babel-scheme-execute-with-geiser
> +		full-body			 ; code
> +		(string= result-type "output")   ; output?
> +		impl				 ; implementation
> +		(and (not (string= session "none")) session))) ; session
> +	      )
> +	 (let ((table
> +		(org-babel-reassemble-table
> +		 result
> +		 (org-babel-pick-name (cdr (assq :colname-names params))
> +				      (cdr (assq :colnames params)))
> +		 (org-babel-pick-name (cdr (assq :rowname-names params))
> +				      (cdr (assq :rownames params))))))
> +	   (org-babel-scheme-table-or-string table))))))
>  
>  (provide 'ob-scheme)
>  
> [3  <text/plain; ISO-8859-1 (quoted-printable)>]
> 
> 
> Best regards:
> 
> José L. Doménech

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

* Re: [PATCH] An amended to the enhance Org babel for scheme blocks
  2017-07-17 17:55 ` [PATCH] An amended to the enhance Org babel for scheme blocks "José L. Doménech"
@ 2017-07-23  9:32   ` Nicolas Goaziou
  2017-07-24  7:27     ` "José L. Doménech"
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2017-07-23  9:32 UTC (permalink / raw)
  To: José L. Doménech; +Cc: Org Mode

Hello,

"José L. Doménech" <domenechjosel@gmail.com> writes:

> Enhance the babel block for scheme.
>
> Allows scheme code blocks to return a table and add a :prologue param
> to the scheme blocks. All :prologue params are prepended to the
> body of code.
>
> * lisp/ob-scheme.el (org-babel-scheme-null-to): New custom option that
>   allows to use a empty list to format the table output, initially
>   assigned to 'hlines.
>   (org-babel-scheme-table-or-string): New helper function to convert
>   the return value from the block as a table or a string.
>   (org-babel-execute-src-block): Changed to allow the return of a
>   table for the output.
>   (org-babel-expand-body:scheme) Add :prologue param support.

Thank you. Some comments follow.

> +(defcustom org-babel-scheme-null-to 'hline
> +  "Replace `null' in scheme tables with this before returning."
> +  :group 'org-babel
> +  :version "24.4"
> +  :package-version '(Org . "8.0")
> +  :type 'symbol)

:version "26.1"
:package-version '(Org . "9.1")

> +(defun org-babel-scheme-table-or-string (results)
> +  "Convert RESULTS into an appropriate elisp value.
> +If the results look like a list or tuple, then convert them into an
> +Emacs-lisp table, otherwise return the results as a string."
> +  (let ((res (org-babel-script-escape results)))
> +    (if (listp res)
> +        (mapcar (lambda (el) (if (or (eq el '()) (eq el 'null))

(eq el '()) -> (null el)

> +	      (result
> +	       (org-babel-scheme-execute-with-geiser
> +		full-body			 ; code
> +		(string= result-type "output")   ; output?
> +		impl				 ; implementation
> +		(and (not (string= session "none")) session))) ; session
> +	      )

The parenthesis needs to be moved at the end of the line above.

Would you mind also providing an ORG-NEWS entry for that change?

Regards,

-- 
Nicolas Goaziou

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

* Re: [PATCH] An amended to the enhance Org babel for scheme blocks
  2017-07-23  9:32   ` Nicolas Goaziou
@ 2017-07-24  7:27     ` "José L. Doménech"
  2017-07-24 10:06       ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: "José L. Doménech" @ 2017-07-24  7:27 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode, "José L. Doménech"

[-- Attachment #1: Type: text/plain, Size: 2947 bytes --]

On Sun, 23 Jul 2017 11:32:14 +0200,
Nicolas Goaziou wrote:
Hello

> 
> Hello,
> 
> "José L. Doménech" <domenechjosel@gmail.com> writes:
> 
> 
> Thank you. Some comments follow.
> 
> 
> :version "26.1"
> :package-version '(Org . "9.1")
>

Done.

> 
> (eq el '()) -> (null el)
>
Done.

> 
> The parenthesis needs to be moved at the end of the line above.
>

Done.

> Would you mind also providing an ORG-NEWS entry for that change?
>

No, but I don't know what is the preferred format for the entries. So
instead of a patch i send the complete entries.
Also I have not explain why I added the :prologue header. I think it is
general enough to be used in more creative ways than mine.

** New Features
*** Babel
***** Scheme: new variable: ~org-babel-scheme-null-to~

 This new custom option allows to use a empty list or null symbol to
 format the table output, initially assigned to 'hlines.

***** Scheme: new function: ~org-babel-scheme-table-or-string~
 
 New helper function to convert the return value from the scheme block
 to a table or a string.

***** Scheme: new header ~:prologue~

 A new block code header has been created for Org Babel that enables
 developers to prepend code to the scheme block being processed.

 Multiple =:prologue= headers can be added each of them using a string
 with the content to be added.

 The scheme blocks are prepared by surronding the code in the block
 with a let form. The content of the =:prologue= headers are prepended
 before this let form.

The Changelog entry:

Allows scheme code blocks to return a table and add a :prologue param
to the scheme blocks. All :prologue params are prepended to the
body of code.

* lisp/ob-scheme.el (org-babel-scheme-null-to): New custom option that
  allows to use a empty list or null symbol to format the table
  output, initially assigned to 'hlines.
  (org-babel-scheme-table-or-string): New helper function to convert
  the return value from the block to a table or a string.
  (org-babel-execute-src-block): Changed to allow the return of a
  table for the output.
  (org-babel-expand-body:scheme) Add :prologue param support.

A improved Changelog entry:

Allows scheme code blocks to return a table and add a :prologue param
to the scheme blocks. All :prologue params are prepended to the
body of code.

* lisp/ob-scheme.el (org-babel-scheme-null-to): New custom option that
  allows to use a empty list or null symbol to format the table
  output, initially assigned to 'hlines.
  (org-babel-scheme-table-or-string): New helper function to convert
  the return value from the block to a table or a string.
  (org-babel-execute-src-block): Changed to allow the return of a
  table for the output.
  (org-babel-expand-body:scheme) Add :prologue param support.

> Regards,
> 
> -- 
> Nicolas Goaziou

Thank you,

José L. Doménech

The modified patch:


[-- Attachment #2: ob-scheme.el.patch --]
[-- Type: text/plain, Size: 3641 bytes --]

diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el
index cd8c386..3c0500e 100644
--- a/lisp/ob-scheme.el
+++ b/lisp/ob-scheme.el
@@ -51,14 +51,24 @@
                   (start end &optional and-go raw nomsg))
 (declare-function geiser-repl-exit "ext:geiser-repl" (&optional arg))
 
+(defcustom org-babel-scheme-null-to 'hline
+  "Replace `null' and empty lists in scheme tables with this before returning."
+  :group 'org-babel
+  :version "26.1"
+  :package-version '(Org . "9.1")
+  :type 'symbol)
+
 (defvar org-babel-default-header-args:scheme '()
   "Default header arguments for scheme code blocks.")
 
 (defun org-babel-expand-body:scheme (body params)
   "Expand BODY according to PARAMS, return the expanded body."
-  (let ((vars (org-babel--get-vars params)))
+  (let ((vars (org-babel--get-vars params))
+	(prepends (cl-remove-if-not (lambda (x) (eq (car x) :prologue)) params)))
     (if (> (length vars) 0)
-        (concat "(let ("
+        (concat (mapconcat (lambda (p) (format "%s" (cdr p)))
+			   prepends "\n     ")
+	        "(let ("
                 (mapconcat
                  (lambda (var) (format "%S" (print `(,(car var) ',(cdr var)))))
                  vars "\n      ")
@@ -176,6 +186,20 @@ is true; otherwise returns the last value."
 		       result))))
     result))
 
+(defun org-babel-scheme-table-or-string (results)
+  "Convert RESULTS into an appropriate elisp value.
+If the results look like a list or tuple, then convert them into an
+Emacs-lisp table, otherwise return the results as a string."
+  (let ((res (org-babel-script-escape results)))
+    (cond ((listp res)
+           (mapcar (lambda (el)
+		     (if (or (null el) (eq el 'null))
+			 org-babel-scheme-null-to
+		       el))
+                   res))
+	  (t
+	   res))))
+
 (defun org-babel-execute:scheme (body params)
   "Execute a block of Scheme code with org-babel.
 This function is called by `org-babel-execute-src-block'"
@@ -184,7 +208,6 @@ This function is called by `org-babel-execute-src-block'"
 			      "^ ?\\*\\([^*]+\\)\\*" "\\1"
 			      (buffer-name source-buffer))))
     (save-excursion
-      (org-babel-reassemble-table
        (let* ((result-type (cdr (assq :result-type params)))
 	      (impl (or (when (cdr (assq :scheme params))
 			  (intern (cdr (assq :scheme params))))
@@ -192,16 +215,21 @@ This function is called by `org-babel-execute-src-block'"
 			(car geiser-active-implementations)))
 	      (session (org-babel-scheme-make-session-name
 			source-buffer-name (cdr (assq :session params)) impl))
-	      (full-body (org-babel-expand-body:scheme body params)))
-	 (org-babel-scheme-execute-with-geiser
-	  full-body			 ; code
-	  (string= result-type "output") ; output?
-	  impl				 ; implementation
-	  (and (not (string= session "none")) session))) ; session
-       (org-babel-pick-name (cdr (assq :colname-names params))
-			    (cdr (assq :colnames params)))
-       (org-babel-pick-name (cdr (assq :rowname-names params))
-			    (cdr (assq :rownames params)))))))
+	      (full-body (org-babel-expand-body:scheme body params))
+	      (result
+	       (org-babel-scheme-execute-with-geiser
+		full-body			 ; code
+		(string= result-type "output")   ; output?
+		impl				 ; implementation
+		(and (not (string= session "none")) session)))) ; session
+	 (let ((table
+		(org-babel-reassemble-table
+		 result
+		 (org-babel-pick-name (cdr (assq :colname-names params))
+				      (cdr (assq :colnames params)))
+		 (org-babel-pick-name (cdr (assq :rowname-names params))
+				      (cdr (assq :rownames params))))))
+	   (org-babel-scheme-table-or-string table))))))
 
 (provide 'ob-scheme)
 

[-- Attachment #3: Type: text/plain, Size: 1 bytes --]



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

* Re: [PATCH] An amended to the enhance Org babel for scheme blocks
  2017-07-24  7:27     ` "José L. Doménech"
@ 2017-07-24 10:06       ` Nicolas Goaziou
  2017-07-24 10:44         ` "José L. Doménech"
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2017-07-24 10:06 UTC (permalink / raw)
  To: José L. Doménech; +Cc: Org Mode

Hello,

"José L. Doménech" <domenechjosel@gmail.com> writes:

> No, but I don't know what is the preferred format for the entries. So
> instead of a patch i send the complete entries.

OK.

> ***** Scheme: new function: ~org-babel-scheme-table-or-string~
>  
>  New helper function to convert the return value from the scheme block
>  to a table or a string.

I think this can be kept as an internal function, and named
`org-babel-scheme--table-or-string'.

> * lisp/ob-scheme.el (org-babel-scheme-null-to): New custom option that
>   allows to use a empty list or null symbol to format the table
>   output, initially assigned to 'hlines.

  * lisp/ob-scheme.el (org-babel-scheme-null-to): New variable.

is sufficient in this case.

>   (org-babel-scheme-table-or-string): New helper function to convert
>   the return value from the block to a table or a string.

Likewise: "New function."

> +(defun org-babel-scheme-table-or-string (results)

Per above, I suggest to name it `org-babel-scheme--table-or-string' and
update the code accordingly.

I made the changes suggested above and added a "TINYCHANGE" cookie at
the end of the commit message since I don't know I you signed the FSF
papers already. I you haven't, please consider doing it.

Thank you!

Regards,

-- 
Nicolas Goaziou

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

* Re: [PATCH] An amended to the enhance Org babel for scheme blocks
  2017-07-24 10:06       ` Nicolas Goaziou
@ 2017-07-24 10:44         ` "José L. Doménech"
  0 siblings, 0 replies; 6+ messages in thread
From: "José L. Doménech" @ 2017-07-24 10:44 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode, "José L. Doménech"

On Mon, 24 Jul 2017 12:06:09 +0200,
Nicolas Goaziou wrote:
> 
> Hello,
 
> I made the changes suggested above and added a "TINYCHANGE" cookie at
> the end of the commit message since I don't know I you signed the FSF
> papers already. I you haven't, please consider doing it.
> 
> Thank you!
> 
> Regards,
>
> -- 
> Nicolas Goaziou

Thanks for the corrections.

I had already completed the assignment to the FSF for the Emacs proyect (about 17 Nov 2016).

Best regards:

José L. Doménech

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

end of thread, other threads:[~2017-07-24 10:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-16 17:08 Enhance Org babel scheme "José L. Doménech"
2017-07-17 17:55 ` [PATCH] An amended to the enhance Org babel for scheme blocks "José L. Doménech"
2017-07-23  9:32   ` Nicolas Goaziou
2017-07-24  7:27     ` "José L. Doménech"
2017-07-24 10:06       ` Nicolas Goaziou
2017-07-24 10:44         ` "José L. Doménech"

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).