emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Another babel scheme issue
@ 2015-09-16 19:12 Lawrence Bottorff
  2015-09-16 19:30 ` Nick Dokos
  0 siblings, 1 reply; 5+ messages in thread
From: Lawrence Bottorff @ 2015-09-16 19:12 UTC (permalink / raw)
  To: emacs-orgmode

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

The patch to ob-scheme.el that Nick Dokos provided is working well. But
another ob-scheme/geiser problem has come up. The code below

#+name: letter
#+header:
#+begin_src scheme :exports both :session ch1
(require 2htdp/batch-io)
(define (letter fst lst signature-name)
  (string-append
   (opening fst)
   "\n\n"
   (body fst lst)
   "\n\n"
   (closing signature-name)))

(define (opening fst)
  (string-append "Dear " fst ","))

(define (body fst lst)
  (string-append
   "We have discovered that all people with the last name " "\n"
   lst " have won our lottery. So, " fst ", " "\n"
   "hurry and pick up your prize."))

(define (closing signature-name)
  (string-append
   "Sincerely,"
   "\n\n"
   signature-name
   "\n"))
#+end_src

comes from How To Design Programs 2nEd, and C-c C-c "compiles" fine when
geiser is set to racket (or chicken). However C- C-c-ing

#+BEGIN_SRC scheme :session ch1
(write-file 'stdout (letter "Matthew" "Fisler" "Felleisen"))
#+END_SRC

produces

#+RESULTS:
: stdout

. . . i,e., no formatted output in my org buffer. However then comes a
geiser DBG (quasi-debug) buffer atop the racket "ch1" buffer:

;; -*- geiser-scheme-implementation: racket -*-
(write-file 'stdout (letter "Matthew" "Fisler" "Felleisen"))

=> stdout

Dear Matthew,

We have discovered that all people with the last name
Fisler have won our lottery. So, Matthew,
hurry and pick up your prize.

Sincerely,

Felleisen

. . . so odd how this is the correct output formatting, but is not inserted
into my org buffer; instead, given to me as a debug screen. Also, running
this code in chicken scheme (without the racket require line, rather a
(print ...) wrapped around letter's string-append form) produces the same
behavior. It would seem ob-scheme and geiser aren't liking standard output
printing. But then running with no require/print formatting works fine, but
of course without print formatting:

#+RESULTS:
: "Dear Matthew,\n\nWe have discovered that all people with the last name
\nFisler have won our lottery. So, Matthew, \nhurry and pick up your
prize.\n\nSincerely,\n\nFelleisen\n"

This isn't a huge issue, but I'd like to figure this out before I show it
to my students.

LB

[-- Attachment #2: Type: text/html, Size: 3338 bytes --]

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

* Re: Another babel scheme issue
  2015-09-16 19:12 Another babel scheme issue Lawrence Bottorff
@ 2015-09-16 19:30 ` Nick Dokos
  2015-09-16 21:13   ` Lawrence Bottorff
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Dokos @ 2015-09-16 19:30 UTC (permalink / raw)
  To: emacs-orgmode

Lawrence Bottorff <borgauf@gmail.com> writes:

> ...
> However C- C-c-ing
>
> #+BEGIN_SRC scheme :session ch1
> (write-file 'stdout (letter "Matthew" "Fisler" "Felleisen"))
> #+END_SRC
>
> produces 
>
> #+RESULTS:
> : stdout
>

I presume write-file returns stdout as its value (?).

Does

#+BEGIN_SRC scheme :session ch1 :results output
(write-file 'stdout (letter "Matthew" "Fisler" "Felleisen"))
#+END_SRC

work?

[Untested]

Nick

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

* Re: Another babel scheme issue
  2015-09-16 19:30 ` Nick Dokos
@ 2015-09-16 21:13   ` Lawrence Bottorff
  2015-09-16 21:56     ` Nick Dokos
  0 siblings, 1 reply; 5+ messages in thread
From: Lawrence Bottorff @ 2015-09-16 21:13 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

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

Sort of. It doesn't give me a geiser dbg buffer, rather

#+RESULTS:
: "Dear Matthew,\n\nWe have discovered that all people with the last name
\nFisler have won our lottery. So, Matthew, \nhurry and pick up your
prize.\n\nSincerely,\n\nFelleisen\n"

Tthat is, it puts it in my org buffer, but it ignores the formatting. Same
behavior with chicken.


On Wed, Sep 16, 2015 at 3:30 PM, Nick Dokos <ndokos@gmail.com> wrote:

> Lawrence Bottorff <borgauf@gmail.com> writes:
>
> > ...
> > However C- C-c-ing
> >
> > #+BEGIN_SRC scheme :session ch1
> > (write-file 'stdout (letter "Matthew" "Fisler" "Felleisen"))
> > #+END_SRC
> >
> > produces
> >
> > #+RESULTS:
> > : stdout
> >
>
> I presume write-file returns stdout as its value (?).
>
> Does
>
> #+BEGIN_SRC scheme :session ch1 :results output
> (write-file 'stdout (letter "Matthew" "Fisler" "Felleisen"))
> #+END_SRC
>
> work?
>
> [Untested]
>
> Nick
>
>
>

[-- Attachment #2: Type: text/html, Size: 1644 bytes --]

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

* Re: Another babel scheme issue
  2015-09-16 21:13   ` Lawrence Bottorff
@ 2015-09-16 21:56     ` Nick Dokos
  2015-09-16 23:26       ` Lawrence Bottorff
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Dokos @ 2015-09-16 21:56 UTC (permalink / raw)
  To: emacs-orgmode

Lawrence Bottorff <borgauf@gmail.com> writes:

> Sort of. It doesn't give me a geiser dbg buffer, rather
>
> #+RESULTS:
> : "Dear Matthew,\n\nWe have discovered that all people with the last name \nFisler have won our lottery.
> So, Matthew, \nhurry and pick up your prize.\n\nSincerely,\n\nFelleisen\n"
>
> Tthat is, it puts it in my org buffer, but it ignores the formatting. Same behavior with chicken.
>

There may some formatting missing at the end of org-babel-execute:scheme.
Comparing it to org-babel-execute:emacs-lisp in ob-emacs-lisp.el, the
latter calls org-babel-result-cond and does some mucking around with the
result in the scalar/verbatim cases.  Maybe a similar thing should be
done in ob-scheme.el.

> On Wed, Sep 16, 2015 at 3:30 PM, Nick Dokos <ndokos@gmail.com> wrote:
>
>     Lawrence Bottorff <borgauf@gmail.com> writes:
>    
>     > ...
>     > However C- C-c-ing
>     >
>     > #+BEGIN_SRC scheme :session ch1
>     > (write-file 'stdout (letter "Matthew" "Fisler" "Felleisen"))
>     > #+END_SRC
>     >
>     > produces 
>     >
>     > #+RESULTS:
>     > : stdout
>     >
>    
>     I presume write-file returns stdout as its value (?).
>    
>     Does
>    
>     #+BEGIN_SRC scheme :session ch1 :results output
>     (write-file 'stdout (letter "Matthew" "Fisler" "Felleisen"))
>     #+END_SRC
>    
>     work?
>    
>     [Untested]
>    

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

* Re: Another babel scheme issue
  2015-09-16 21:56     ` Nick Dokos
@ 2015-09-16 23:26       ` Lawrence Bottorff
  0 siblings, 0 replies; 5+ messages in thread
From: Lawrence Bottorff @ 2015-09-16 23:26 UTC (permalink / raw)
  To: emacs-orgmode

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

I appreciate your efforts, ND. No silver bullet is just lying around, so I
think I can live with this for the time being. Must learn elisp I.

LB

On Wed, Sep 16, 2015 at 9:56 PM, Nick Dokos <ndokos@gmail.com> wrote:

> Lawrence Bottorff <borgauf@gmail.com> writes:
>
> > Sort of. It doesn't give me a geiser dbg buffer, rather
> >
> > #+RESULTS:
> > : "Dear Matthew,\n\nWe have discovered that all people with the last
> name \nFisler have won our lottery.
> > So, Matthew, \nhurry and pick up your
> prize.\n\nSincerely,\n\nFelleisen\n"
> >
> > Tthat is, it puts it in my org buffer, but it ignores the formatting.
> Same behavior with chicken.
> >
>
> There may some formatting missing at the end of org-babel-execute:scheme.
> Comparing it to org-babel-execute:emacs-lisp in ob-emacs-lisp.el, the
> latter calls org-babel-result-cond and does some mucking around with the
> result in the scalar/verbatim cases.  Maybe a similar thing should be
> done in ob-scheme.el.
>
> > On Wed, Sep 16, 2015 at 3:30 PM, Nick Dokos <ndokos@gmail.com> wrote:
> >
> >     Lawrence Bottorff <borgauf@gmail.com> writes:
> >
> >     > ...
> >     > However C- C-c-ing
> >     >
> >     > #+BEGIN_SRC scheme :session ch1
> >     > (write-file 'stdout (letter "Matthew" "Fisler" "Felleisen"))
> >     > #+END_SRC
> >     >
> >     > produces
> >     >
> >     > #+RESULTS:
> >     > : stdout
> >     >
> >
> >     I presume write-file returns stdout as its value (?).
> >
> >     Does
> >
> >     #+BEGIN_SRC scheme :session ch1 :results output
> >     (write-file 'stdout (letter "Matthew" "Fisler" "Felleisen"))
> >     #+END_SRC
> >
> >     work?
> >
> >     [Untested]
> >
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 2625 bytes --]

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

end of thread, other threads:[~2015-09-16 23:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-16 19:12 Another babel scheme issue Lawrence Bottorff
2015-09-16 19:30 ` Nick Dokos
2015-09-16 21:13   ` Lawrence Bottorff
2015-09-16 21:56     ` Nick Dokos
2015-09-16 23:26       ` Lawrence Bottorff

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