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

Helmut Eller heller at common-lisp.net
Tue Oct 26 00:28:17 UTC 2004


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

Modified Files:
	slime.el 
Log Message:
(slime-init-command): New function to send the command to load swank.
Havering a separate function for the task should make it easier to
start a Lips with a preloaded swank.
(slime-maybe-start-lisp): Use it.
(slime-maybe-start-multiprocessing): Deleted.

(slime-repl-buffer): Include the name of the implementation.

(slime-set-default-directory)
(slime-sync-package-and-default-directory): Translate filenames.
Date: Tue Oct 26 02:28:16 2004
Author: heller

Index: slime/slime.el
diff -u slime/slime.el:1.413 slime/slime.el:1.414
--- slime/slime.el:1.413	Mon Oct 25 18:15:19 2004
+++ slime/slime.el	Tue Oct 26 02:28:16 2004
@@ -1284,9 +1284,10 @@
 (defun slime-maybe-start-lisp (command buffername)
   "Start an inferior lisp. Instruct it to load Swank."
   (cond ((not (comint-check-proc buffername))
-         (slime-start-lisp command buffername))
+         (slime-start-lisp command buffername (slime-init-command)))
         ((y-or-n-p "Create an additional *inferior-lisp*? ")
-         (slime-start-lisp command (generate-new-buffer-name buffername)))
+         (slime-start-lisp command (generate-new-buffer-name buffername)
+                           (slime-init-command)))
         (t 
          (when-let (conn (find (get-buffer-process buffername)
                                slime-net-processes 
@@ -1294,25 +1295,28 @@
            (slime-net-close conn))
          (get-buffer-process buffername))))
 
-(defun slime-start-lisp (command buffername)
-  "Start a new Lisp with command and in the buffer BUFFERNAME.
+(defun slime-init-command ()
+  "Return a string to initialize Lisp."
+  (let ((swank (slime-to-lisp-filename (if (file-name-absolute-p slime-backend)
+                                           slime-backend
+                                         (concat slime-path slime-backend))))
+        (mp (if slime-multiprocessing "(swank:startup-multiprocessing)\n" "")))
+    (format "(load %S :verbose t)\n%s" swank mp)))
+
+(defun slime-start-lisp (command buffername init-string)
+  "Start Lisp with COMMAND in BUFFERNAME and send INIT-STRING to it.
 Return the new process."
   (let ((proc (slime-inferior-lisp command buffername)))
     (when slime-kill-without-query-p
       (process-kill-without-query proc))
-    (comint-send-string proc
-                        (format "(load %S :verbose t)\n"
-                                (slime-to-lisp-filename
-                                 (if (file-name-absolute-p slime-backend)
-                                     slime-backend
-                                   (concat slime-path slime-backend)))))
-    (slime-maybe-start-multiprocessing)
-    proc))
+    (when init-string
+      (comint-send-string proc init-string)
+    proc)))
 
 (defun slime-inferior-lisp (command buffername)
   "Does the same as `inferior-lisp' but less ugly.
 Return the created process."
-  (let ((args (split-string command)))
+  (let ((args (split-string command)))  ; XXX consider: cmucl -eval '(+ 1 2)'
     (with-current-buffer (get-buffer-create buffername)
       (comint-mode)
       (comint-exec (current-buffer) "inferior-lisp" (car args) nil (cdr args))
@@ -1321,11 +1325,6 @@
       (pop-to-buffer (current-buffer))
       (get-buffer-process (current-buffer)))))
 
-(defun slime-maybe-start-multiprocessing ()
-  (when slime-multiprocessing
-    (comint-send-string (inferior-lisp-proc)
-                        "(swank:startup-multiprocessing)\n")))
-
 (defun slime-inferior-connect (process &optional retries)
   "Start a Swank server in the inferior Lisp and connect."
   (when (file-regular-p (slime-swank-port-file))
@@ -2443,7 +2442,7 @@
 (defun slime-repl-buffer (&optional create)
   "Get the REPL buffer for the current connection; optionally create."
   (funcall (if create #'get-buffer-create #'get-buffer)
-           (format "*slime-repl[%S]*" (slime-connection-number))))
+           (format "*slime-repl %s*" (slime-connection-name))))
 
 (defun slime-repl-mode () 
   "Major mode for interacting with a superior Lisp.
@@ -3387,9 +3386,9 @@
 
 (defun slime-maybe-list-compiler-notes (notes)
   "Show the compiler notes if appropriate."
-  (unless (or (null notes)
-	      (and (eq last-command 'slime-compile-defun)
-                   (every #'slime-note-has-location-p notes)))
+  ;; don't pop up a buffer if all notes will are already annotated in
+  ;; the buffer itself
+  (unless (every #'slime-note-has-location-p notes)
     (slime-list-compiler-notes notes)))
 
 (defun slime-list-compiler-notes (&optional notes)
@@ -5545,9 +5544,10 @@
 (defun slime-set-default-directory (directory)
   "Make DIRECTION become Lisp's current directory."
   (interactive (list (read-directory-name "Directory: " nil nil t)))
-  (message "default-directory: %s" 
-	   (slime-eval `(swank:set-default-directory
-                         ,(expand-file-name directory))))
+  (message "default-directory: %s"
+           (slime-from-lisp-filename
+            (slime-eval `(swank:set-default-directory
+                          ,(slime-to-lisp-filename directory)))))
   (with-current-buffer (slime-output-buffer)
     (setq default-directory (expand-file-name directory))
     (when (boundp 'header-line-format)
@@ -5558,8 +5558,10 @@
   (interactive)
   (let ((package (slime-eval `(swank:set-package 
 			       ,(slime-find-buffer-package))))
-	(directory (slime-eval `(swank:set-default-directory 
-				 ,(expand-file-name default-directory)))))
+	(directory (slime-from-lisp-filename
+                    (slime-eval `(swank:set-default-directory 
+                                  ,(slime-to-lisp-filename
+                                    default-directory))))))
     (let ((dir default-directory))
       ;; Sync REPL dir
       (with-current-buffer (slime-output-buffer)





More information about the slime-cvs mailing list