[reply-to list only]
* "Nikodemus Siivola" Wrote on Wed, 20 Feb 2008 16:33:56 +0200:
| The attached patch make SLIME-CONNECTION ask "No connection: start | Slime?" if there is no connection -- and then wait for the connection | to come up.
FWIW. I have been patching slime-connection from the very beginning to get this behaviour.
| (defun slime-connection () | "Return the connection to use for Lisp interaction. | Signal an error if there's no connection." | @@ -1868,7 +1873,11 @@ | (cond ((and (not conn) slime-net-processes) | (error "No default connection selected.")) | ((not conn) | - (error "Not connected.")) | + (if (not (maybe-slime "No connection: start Slime? ")) | + (error "No connection.") | + (while (not (setq conn (slime-current-connection))) | + (sit-for 1)) | + conn)) | ((not (eq (process-status conn) 'open)) | (error "Connection closed.")) | (t conn))))
The added code [above] would make sense in the next cond branch too. However I typically wish to connect to a lisp running swank at port 4005, started OUTSIDE of emacs --- Here is my local definition, to illustrate the idea
(defun slime-connection () ;;madhu 050404 "Return the connection to use for Lisp interaction. Signal an error if there's no connection." (let ((conn (slime-current-connection))) (unless conn (when slime-net-processes (setq slime-default-connection (car slime-net-processes)) (setq conn (slime-current-connection)))) (cond ((and (not conn) slime-net-processes) (error "No default connection selected. XXX")) ; after trying ((not conn) (or (and (y-or-n-p "Not connected. connect now? ") (slime-connect "localhost" 4005)) (error "Not connected."))) ((not (eq (process-status conn) 'open)) (or (and (y-or-n-p "Connection closed. connect now? ") (slime-connect "localhost" 4005)) (error "Connection closed."))) (t conn))))
| Reasons I did not merge this straightaway: | | * It would be a lot better if Slime started by SLIME-CONNECTION | like this didn't rearrange windows the way it now does.
This [rearrangement of windows] is indeed annoying
-- Madhu