[slime-devel] Problems with swank connection

Hi there, I´m using slime and I'm having a problem with the swank connection: (save-current-buffer (slime-disconnect) (if (get-buffer "*inferior-lisp*") (kill-buffer "*inferior-lisp*")) (slime) (if (not (slime-connected-p)) <error, do something> )) The problem is that the function 'slime-connected-p' is returning 'nil', meaning that there isn't a swank connection... Can somebody tell me why? I'm using windows xp, my lisp implementation is Allegro CL (version 7), and my Emacs is GNU Emacs 21.3.1. Best regards, Henda

"Henda Carvalho" <henda.for.work@gmail.com> writes:
(save-current-buffer (slime-disconnect) (if (get-buffer "*inferior-lisp*") (kill-buffer "*inferior-lisp*")) (slime)
(if (not (slime-connected-p)) <error, do something> ))
The problem is that the function 'slime-connected-p' is returning 'nil', meaning that there isn't a swank connection... Can somebody tell me why?
IIRC the call to SLIME returns almost immediately, but setting the connection up takes a while -- so you need to wait for it a bit. Cheers, -- Nikodemus Schemer: "Buddha is small, clean, and serious." Lispnik: "Buddha is big, has hairy armpits, and laughs."

I had the same issue. You can add a hook, like this: (add-hook 'slime-connected-hook 'your-hook) to get the appropriate actions to happen AFTER slime is set up. -austin Nikodemus Siivola wrote:
"Henda Carvalho" <henda.for.work@gmail.com> writes:
(save-current-buffer (slime-disconnect) (if (get-buffer "*inferior-lisp*") (kill-buffer "*inferior-lisp*")) (slime)
(if (not (slime-connected-p)) <error, do something> ))
The problem is that the function 'slime-connected-p' is returning 'nil', meaning that there isn't a swank connection... Can somebody tell me why?
IIRC the call to SLIME returns almost immediately, but setting the connection up takes a while -- so you need to wait for it a bit.
Cheers,
-- Nikodemus Schemer: "Buddha is small, clean, and serious." Lispnik: "Buddha is big, has hairy armpits, and laughs."
_______________________________________________ slime-devel site list slime-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/slime-devel

I changed the code to: (save-current-buffer (slime-disconnect) (if (get-buffer "*inferior-lisp*") (kill-buffer "*inferior-lisp*")) (slime) (while (not (slime-connected-p)) (sleep-for 1))) and it stays in the 'while' loop for more than 5 minutes (i "only" waited 5 minutes), meaning that 'slime-connected-p' is returning 'nil'... Can you tell why i can't make the connection? Best regards, Henda On 6/12/06, Nikodemus Siivola <nikodemus@random-state.net> wrote:
"Henda Carvalho" <henda.for.work@gmail.com> writes:
(save-current-buffer (slime-disconnect) (if (get-buffer "*inferior-lisp*") (kill-buffer "*inferior-lisp*")) (slime)
(if (not (slime-connected-p)) <error, do something> ))
The problem is that the function 'slime-connected-p' is returning 'nil', meaning that there isn't a swank connection... Can somebody tell me why?
IIRC the call to SLIME returns almost immediately, but setting the connection up takes a while -- so you need to wait for it a bit.
Cheers,
-- Nikodemus Schemer: "Buddha is small, clean, and serious." Lispnik: "Buddha is big, has hairy armpits, and laughs."
_______________________________________________ slime-devel site list slime-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/slime-devel

* Henda Carvalho [2006-06-13 19:35+0200] writes:
I changed the code to:
(save-current-buffer (slime-disconnect) (if (get-buffer "*inferior-lisp*") (kill-buffer "*inferior-lisp*")) (slime) (while (not (slime-connected-p)) (sleep-for 1)))
I could be wrong, but I think sleep-for doesn't do what you think it does. In particular, sleep-for doesn't call timer functions, which is needed to toggle the connected-p flag. Try sit-for instead. Consider something like: (lexical-let ((hook nil) (done nil)) (setq hook (lambda () (remove-hook 'slime-connected-hook hook) (setq done t))) (add-hook 'slime-connected-hook hook) (slime) (while (not done) (sit-for 1)))
and it stays in the 'while' loop for more than 5 minutes (i "only" waited 5 minutes), meaning that 'slime-connected-p' is returning 'nil'...
Can you tell why i can't make the connection?
Again I could be wrong, but apparently you are trying to restart the Lisp process and connecting to it. Have a look at slime-restart-inferior-lisp(-aux) to see how to properly kill the process. Helmut.
participants (4)
-
Austin Haas
-
Helmut Eller
-
Henda Carvalho
-
Nikodemus Siivola