From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Scheme code block gives false error message Date: Mon, 14 Sep 2015 23:10:52 -0400 Message-ID: <87lhc8gywz.fsf@pierrot.dokosmarshall.org> References: <877fnuj2q4.fsf@pierrot.dokosmarshall.org> <87y4gagkxc.fsf@pierrot.dokosmarshall.org> <87twqxglwu.fsf@pierrot.dokosmarshall.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbgeQ-0001UP-Fe for emacs-orgmode@gnu.org; Mon, 14 Sep 2015 23:11:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZbgeN-0002YE-7U for emacs-orgmode@gnu.org; Mon, 14 Sep 2015 23:11:22 -0400 Received: from plane.gmane.org ([80.91.229.3]:35632) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbgeM-0002W2-WE for emacs-orgmode@gnu.org; Mon, 14 Sep 2015 23:11:19 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZbgeJ-0001al-Nl for emacs-orgmode@gnu.org; Tue, 15 Sep 2015 05:11:15 +0200 Received: from pool-108-20-41-232.bstnma.fios.verizon.net ([108.20.41.232]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 15 Sep 2015 05:11:15 +0200 Received: from ndokos by pool-108-20-41-232.bstnma.fios.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 15 Sep 2015 05:11:15 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Nick Dokos writes: > Lawrence Bottorff writes: > >> I think this >> (https://mobiusengineering.wordpress.com/2015/01/11/using-emacs-org-with-mit-scheme/) >> describes my problem. Basically, it's with ob-scheme.el. The article >> seems to say that my problem is scheme stuff being handled improperly >> by the elisp of ob-scheme.el. > > Yes, that sounds right. > >> I'll try his workaround and see if it works. He also seems to believe Scheme is a second-class >> citizen in babel-land. >> Actually... I don't know why that (read result) is there at all: result is a string representation of the result that the scheme interpreter returned. It does not make any sense to me that we try to read that and make it into an elisp object: we should just return the string itself. With that change (see attached patch) on more-or-less current master (the exact version is Org-mode version 8.3.1 (release_8.3.1-236-g14f5f6 @ /home/nick/src/emacs/org/org-mode/lisp/), I can evaluate everything that you sent out without any error (see attached file "scheme.org" which includes evaluation results). N.B. this is with guile: I have not tried chicken, MIT Scheme or any other scheme implementation. Thoughts? -- Nick --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Return-result-not-read-result-from-org-babel-scheme-.patch Content-Description: [PATCH-RFC] org-babel-scheme-execute-with-geiser fix >From 14f5f6312f77b0252f4d29609f996af42c78a938 Mon Sep 17 00:00:00 2001 From: Nick Dokos Date: Mon, 14 Sep 2015 22:51:26 -0400 Subject: [PATCH] Return result, not (read result) from org-babel-scheme-execute-with-geiser --- lisp/ob-scheme.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el index b10dfc3..c8f7f5e 100644 --- a/lisp/ob-scheme.el +++ b/lisp/ob-scheme.el @@ -172,7 +172,7 @@ is true; otherwise returns the last value." (setq result (if (or (string= result "#") (string= result "#")) nil - (read result))))) + result)))) result)) (defun org-babel-execute:scheme (body params) -- 2.4.3 --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=scheme.org Content-Description: scheme.org - scheme examples from Lawrence Bottorff #+BEGIN_SRC scheme :session ch1 :exports both (define (check-it x) (cond ((string? x) (string-length x)) ((number? x) (if (<= x 0) x (- x 1))) ((boolean? x) (if (and #t x) 10 20)) (else #f))) #+END_SRC #+RESULTS: #+BEGIN_SRC scheme :session ch1 (define (square x) (* x x)) #+END_SRC #+RESULTS: #+BEGIN_SRC scheme :session ch1 (check-it "Foobar") #+END_SRC #+RESULTS: : 6 #+BEGIN_SRC scheme :session ch1 (square 5) #+END_SRC #+RESULTS: : 25 #+BEGIN_SRC scheme :session ch1 :exports both (define (bool-imply a b) (if (or (not a) b) #t #f)) #+END_SRC #+RESULTS: #+BEGIN_SRC scheme :session ch1 :exports both (bool-imply #t #f) #+END_SRC #+RESULTS: : #f #+BEGIN_SRC scheme :session ch1 :exports both map #+END_SRC #+RESULTS: : # --=-=-=--