From: GSz
Subject: Running CMUCL without the REPL?
Date: 
Message-ID: <d9i4rn$muq$1@nemesis.news.tpi.pl>
Hi.  

Is it possible to exit the REPL in CMUCL without actually exiting
the program?  I know this sounds a bit insane, but what I want is the
ability to do some curses programming (with cl-ncurses) from within
Emacs and SLIME.

So I start CMUCL in a terminal, manually run swank and connect to it
from SLIME. I can then use curses calls to do stuff with the terminal
I ran CMUCL on. The problem arises when I try to read something, a
single character for example. I call getch, type the char in the
terminal, and sure thing, it gets returned by getch. But it also gets
read by the REPL running in the terminal, with isn't exactly what I want.

So, is it possible to get rid of the first REPL?

From: Eric Marsden
Subject: Re: Running CMUCL without the REPL?
Date: 
Message-ID: <87vf42s90w.fsf@free.fr>
>>>>> "gsz" == GSz  <·············@NOyahSPAMoo.com> writes:

  gsz> Is it possible to exit the REPL in CMUCL without actually exiting
  gsz> the program?  I know this sounds a bit insane, but what I want is the
  gsz> ability to do some curses programming (with cl-ncurses) from within
  gsz> Emacs and SLIME.

  you can save a CMUCL image that starts a swank listener instead of a
  REPL, by using the :INIT-FUNCTION argument to EXT:SAVE-LISP.
  Something like:
  
    (ext:save-lisp "/tmp/cmucl-swank.img"
         :init-function (lambda () (swank:create-swank-server)
                           (loop (sys:serve-all-events))))

  Start the image with "lisp -core cmucl-swank.img" and connect
  to it from Emacs with "M-x slime-connect". 

-- 
Eric Marsden
From: Rob Warnock
Subject: Re: Running CMUCL without the REPL?
Date: 
Message-ID: <yJudndNvEOHCuCPfRVn-2w@speakeasy.net>
Eric Marsden  <············@free.fr> wrote:
+---------------
| >>>>> "gsz" == GSz  <·············@NOyahSPAMoo.com> writes:
|   gsz> Is it possible to exit the REPL in CMUCL without actually exiting
|   gsz> the program?  I know this sounds a bit insane, but what I want is the
|   gsz> ability to do some curses programming (with cl-ncurses) from within
|   gsz> Emacs and SLIME.
| 
|   you can save a CMUCL image that starts a swank listener instead of a
|   REPL, by using the :INIT-FUNCTION argument to EXT:SAVE-LISP.
|   Something like:
|     (ext:save-lisp "/tmp/cmucl-swank.img"
|          :init-function (lambda () (swank:create-swank-server)
|                            (loop (sys:serve-all-events))))
|   Start the image with "lisp -core cmucl-swank.img" and connect
|   to it from Emacs with "M-x slime-connect". 
+---------------

Or equivalently, shouldn't it work for him to simply type the
following to the REPL of a normal image?

    (progn
      (swank:create-swank-server)
      (loop (sys:serve-all-events)))

The LOOP will never return, and thus the REPL will read no more characters.

[Hmmm... Well... Except for hitting the debugger. And then you might or
might not *want* it to be reading...]


-Rob

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Immanuel Litzroth
Subject: Re: Running CMUCL without the REPL?
Date: 
Message-ID: <oe9qagqq.fsf@immanuelinux.site>
Eric Marsden <············@free.fr> writes:
>>>>>> "gsz" == GSz  <·············@NOyahSPAMoo.com> writes:
>
>   gsz> Is it possible to exit the REPL in CMUCL without actually exiting
>   gsz> the program?  I know this sounds a bit insane, but what I want is the
>   gsz> ability to do some curses programming (with cl-ncurses) from within
>   gsz> Emacs and SLIME.
>
>   you can save a CMUCL image that starts a swank listener instead of a
>   REPL, by using the :INIT-FUNCTION argument to EXT:SAVE-LISP.
>   Something like:
>   
>     (ext:save-lisp "/tmp/cmucl-swank.img"
>          :init-function (lambda () (swank:create-swank-server)
>                            (loop (sys:serve-all-events))))
>
>   Start the image with "lisp -core cmucl-swank.img" and connect
>   to it from Emacs with "M-x slime-connect". 

I discovered that in order to not give errors when trying to quit
cmcucl you need to have the init-function return an int when it is 
finished. This is because the return result from this function is
passed to unix::exit which then barfs throws and error and your get
a "Trying to throw to nonexistent tag ...".
Maybe the doc or the implementation should be fixed.
Immanuel