[slime-cvs] CVS slime

heller heller at common-lisp.net
Sat Nov 24 08:14:50 UTC 2007


Update of /project/slime/cvsroot/slime
In directory clnet:/tmp/cvs-serv19400

Modified Files:
	slime.el swank.lisp ChangeLog 
Log Message:
Mirror *modules* in Emacs.

* slime.el (slime-lisp-modules): New connction variable.
(slime-set-connection-info): Load requested modules.
(slime-required-modules): New variable.
(slime-require, slime-load-contribs): New functions.

* swank.lisp (connection-info): Include *modules*.
(swank-require): Accept a list of modules as argument.



--- /project/slime/cvsroot/slime/slime.el	2007/11/24 08:04:27	1.879
+++ /project/slime/cvsroot/slime/slime.el	2007/11/24 08:14:50	1.880
@@ -1933,6 +1933,9 @@
   "The symbol-names of Lisp's *FEATURES*.
 This is automatically synchronized from Lisp.")
 
+(slime-def-connection-var slime-lisp-modules '()
+  "The strings of Lisp's *MODULES*.")
+
 (slime-def-connection-var slime-lisp-package
     "COMMON-LISP-USER"
   "The current package name of the Superior lisp.
@@ -2002,14 +2005,16 @@
   "Initialize CONNECTION with INFO received from Lisp."
   (let ((slime-dispatching-connection connection))
     (destructuring-bind (&key pid style lisp-implementation machine
-                              features package version &allow-other-keys) info
+                              features package version modules
+                              &allow-other-keys) info
       (or (equal version slime-protocol-version)
           (yes-or-no-p "Protocol version mismatch. Continue anyway? ")
           (slime-net-close connection)
           (top-level))
       (setf (slime-pid) pid
             (slime-communication-style) style
-            (slime-lisp-features) features)
+            (slime-lisp-features) features
+            (slime-lisp-modules) modules)
       (destructuring-bind (&key name prompt) package
         (setf (slime-lisp-package) name
               (slime-lisp-package-prompt-string) prompt))
@@ -2029,6 +2034,7 @@
                 (slime-generate-connection-name (symbol-name name)))))
       (slime-hide-inferior-lisp-buffer)
       (slime-init-output-buffer connection)
+      (slime-load-contribs)
       (run-hooks 'slime-connected-hook)
       (when-let (fun (plist-get args ':init-function))
         (funcall fun)))
@@ -7904,6 +7910,27 @@
       (run-hook-with-args 'slime-indentation-update-hooks symbol indent))))
 
 
+;;;; Contrib modules
+
+(defvar slime-required-modules '())
+
+(defun slime-require (module)
+  (assert (keywordp module))
+  (pushnew module slime-required-modules)
+  (when (slime-connected-p)
+    (slime-load-contribs)))
+
+(defun slime-load-contribs ()
+  (let ((needed (remove-if (lambda (s) 
+                             (member (subseq (symbol-name s) 1)
+                                     (mapcar #'downcase (slime-lisp-modules))))
+                           slime-required-modules)))
+    (when needed
+      (slime-eval-async `(swank:swank-require ',needed)
+                        (lambda (new-modules)
+                          (setf (slime-lisp-modules) new-modules))))))
+
+
 ;;;;; Pull-down menu
 
 (defvar slime-easy-menu
--- /project/slime/cvsroot/slime/swank.lisp	2007/11/24 08:04:27	1.517
+++ /project/slime/cvsroot/slime/swank.lisp	2007/11/24 08:14:50	1.518
@@ -1442,6 +1442,7 @@
               :type ,(machine-type)
               :version ,(machine-version))
     :features ,(features-for-emacs)
+    :modules ,*modules*
     :package (:name ,(package-name *package*)
               :prompt ,(package-string-for-prompt *package*))
     :version ,*swank-wire-protocol-version*))
@@ -2269,11 +2270,12 @@
 
 ;;;;; swank-require
 
-(defslimefun swank-require (module &optional filename)
+(defslimefun swank-require (modules &optional filename)
   "Load the module MODULE."
-  (unless (member (string module) *modules* :test #'string=)
-    (require module (or filename (module-filename module))))
-  nil)
+  (dolist (module (if (listp modules) modules (list modules)))
+    (unless (member (string module) *modules* :test #'string=)
+      (require module (or filename (module-filename module)))))
+  *modules*)
 
 (defvar *find-module* 'find-module
   "Pluggable function to locate modules.
--- /project/slime/cvsroot/slime/ChangeLog	2007/11/24 08:04:27	1.1247
+++ /project/slime/cvsroot/slime/ChangeLog	2007/11/24 08:14:50	1.1248
@@ -1,5 +1,17 @@
 2007-11-24  Helmut Eller  <heller at common-lisp.net>
 
+	Mirror *modules* in Emacs.
+	
+	* slime.el (slime-lisp-modules): New connction variable.
+	(slime-set-connection-info): Load requested modules.
+	(slime-required-modules): New variable.
+	(slime-require, slime-load-contribs): New functions.
+
+	* swank.lisp (connection-info): Include *modules*.
+	(swank-require): Accept a list of modules as argument.
+	
+2007-11-24  Helmut Eller  <heller at common-lisp.net>
+
 	* swank.lisp (parse-package): The old version didn't pass the
 	test-suite.  Now use the reader directly instead of emulating it
 	half-heartedly.




More information about the slime-cvs mailing list