From: ·················@gmail.com
Subject: Handling SLIME/Emacs requests in a SDL program (Interactive development)
Date: 
Message-ID: <1172775286.914512.232710@n33g2000cwc.googlegroups.com>
So, I need to handle requests from my SLIME/Emacs connected to a
running SDL application. AFAIK for Clisp SWANK:*COMMUNICATION-STYLE*
can only be set to :FD-HANDLER.
Consider following application:

(in-package #:sdl-examples)
(defparameter *color* #(0 0 0))
(defun setup-and-draw ()
  (let ((width 200) (height 200))
    (sdl:with-init ()
      (sdl:set-framerate 30)
      (sdl:with-display (width height :title-caption "Just an empty
window")
	(sdl:with-events ()
	  (:quit () t)
	  (:idle ()
                   ;;Need some function call at this place to be able
to handle SLIME
                   ;;requests interactively
		 (sdl:clear-display :color *color*)
		 (sdl:update-display)))))))

If I change *color* from REPL while running the program, I have to
close the program for SWANK to be able to handle request from SLIME`s
REPL.
What should I call in my code to handle requests manually?
(for some C++/Windows programs similar functions are often called
"Yield")

From: justinhj
Subject: Re: Handling SLIME/Emacs requests in a SDL program (Interactive development)
Date: 
Message-ID: <1172777744.322274.241890@z35g2000cwz.googlegroups.com>
On Mar 1, 1:54 pm, ·················@gmail.com wrote:
> So, I need to handle requests from my SLIME/Emacs connected to a
> running SDL application. AFAIK for Clisp SWANK:*COMMUNICATION-STYLE*
> can only be set to :FD-HANDLER.
> Consider following application:
>
> (in-package #:sdl-examples)
> (defparameter *color* #(0 0 0))
> (defun setup-and-draw ()
>   (let ((width 200) (height 200))
>     (sdl:with-init ()
>       (sdl:set-framerate 30)
>       (sdl:with-display (width height :title-caption "Just an empty
> window")
>         (sdl:with-events ()
>           (:quit () t)
>           (:idle ()
>                    ;;Need some function call at this place to be able
> to handle SLIME
>                    ;;requests interactively
>                  (sdl:clear-display :color *color*)
>                  (sdl:update-display)))))))
>
> If I change *color* from REPL while running the program, I have to
> close the program for SWANK to be able to handle request from SLIME`s
> REPL.
> What should I call in my code to handle requests manually?
> (for some C++/Windows programs similar functions are often called
> "Yield")

You can run slime-connect to open a new REPL. From there you can
evaluate expressions, make new functions, change variables at top
level scope etc.

If you want some kind of pause mode while you make changes you can
build that into your code and have a top level variable to control it.

Justin
From: ·················@gmail.com
Subject: Re: Handling SLIME/Emacs requests in a SDL program (Interactive development)
Date: 
Message-ID: <1172778796.778593.293240@z35g2000cwz.googlegroups.com>
> You can run slime-connect to open a new REPL. From there you can
> evaluate expressions, make new functions, change variables at top
> level scope etc.
> If you want some kind of pause mode while you make changes you can
> build that into your code and have a top level variable to control it.

Thanks, but I don`t want to pause my program nor to open new REPL. I
want my program to periodically listen for incoming requests from
REPL. I sure there must be such a function in SWANK.
From: Harold Lee
Subject: Re: Handling SLIME/Emacs requests in a SDL program (Interactive development)
Date: 
Message-ID: <1172788391.890591.252410@30g2000cwc.googlegroups.com>
On Mar 1, 11:53 am, ·················@gmail.com wrote:
> > You can run slime-connect to open a new REPL. From there you can
> > evaluate expressions, make new functions, change variables at top
> > level scope etc.
> > If you want some kind of pause mode while you make changes you can
> > build that into your code and have a top level variable to control it.
>
> Thanks, but I don`t want to pause my program nor to open new REPL. I
> want my program to periodically listen for incoming requests from
> REPL. I sure there must be such a function in SWANK.

(swank:create-swank-server)
From: ·················@gmail.com
Subject: Re: Handling SLIME/Emacs requests in a SDL program (Interactive development)
Date: 
Message-ID: <1172912548.994424.168320@p10g2000cwp.googlegroups.com>
> (swank:create-swank-server)
No, this is not the thing.

For now I have this:
(defparameter *color* #(0 0 0))

(defun yield ()
  (when (listen (swank::connection.socket-io (swank::default-
connection)))
    (setf swank::*swank-state-stack* nil)
    (swank::serve-requests (swank::default-connection))))

(defun setup-and-draw ()
  (let ((width 200) (height 200))
    (sdl:with-init ()
      (sdl:set-framerate 30)
      (sdl:with-display (width height :title-caption "Empty window")
	(sdl:with-events ()
	  (:quit () t)
	  (:idle ()
		 (yield)
		 (sdl:clear-display :color *color*)
		 (sdl:update-display)))))))

(setup-and-draw)


Although, it`s not working. It listens for the emacs input and when
it`s available it executes it. But then it doesn`t return to the
original program thus making it stick.

There are seem to be 2 solutions:
1. write my own SWANK
2. throw the things away and use something more acceptable. Possibly
Allegro.