[slime-cvs] CVS update: slime/slime.el

Helmut Eller heller at common-lisp.net
Thu Sep 23 22:22:18 UTC 2004


Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv12342

Modified Files:
	slime.el 
Log Message:
(slime-start-and-load): Only start SLIME is if it is not running.


Date: Fri Sep 24 00:22:17 2004
Author: heller

Index: slime/slime.el
diff -u slime/slime.el:1.402 slime/slime.el:1.403
--- slime/slime.el:1.402	Thu Sep 23 23:18:04 2004
+++ slime/slime.el	Fri Sep 24 00:22:17 2004
@@ -1184,20 +1184,25 @@
     (message "Connected. %s" (slime-random-words-of-encouragement))))
 
 (defun slime-start-and-load (filename &optional package)
-  "Start Slime, load the current file and set the package."
+  "Start Slime, if needed, load the current file and set the package."
   (interactive (list (expand-file-name (buffer-file-name))
                      (slime-find-buffer-package)))
-  (lexical-let ((hook nil) (package package) 
-                (filename (slime-to-lisp-filename filename)))
-    (setq hook (lambda ()
-                 (remove-hook 'slime-connected-hook hook)
-                 (slime-eval-async 
-                  `(swank:load-file ,filename)
-                  (lambda (result)
-                    (when package
-                      (slime-repl-set-package package))))))
-    (add-hook 'slime-connected-hook hook)
-    (slime)))
+  (cond ((slime-connected-p)
+         (slime-load-file-set-package filename package))
+        (t
+         (lexical-let ((hook nil) (package package) (filename filename))
+           (setq hook (lambda ()
+                        (remove-hook 'slime-connected-hook hook)
+                        (slime-load-file-set-package filename package)))
+           (add-hook 'slime-connected-hook hook)
+           (slime)))))
+
+(defun slime-load-file-set-package (filename package)
+  (let ((filename (slime-to-lisp-filename filename)))
+    (slime-eval-async `(swank:load-file-set-package ,filename ,package)
+                      (lambda (package)
+                        (when package
+                          (slime-repl-set-package (second package)))))))
 
 ;;;;; Start inferior lisp
 ;;;





More information about the slime-cvs mailing list