[slime-cvs] CVS update: slime/swank.lisp

Luke Gorrie lgorrie at common-lisp.net
Wed Apr 7 09:53:25 UTC 2004


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

Modified Files:
	swank.lisp 
Log Message:
(completion-set): Also complete package names.
(Patch from Sean O'Rourke.)

Date: Wed Apr  7 05:53:25 2004
Author: lgorrie

Index: slime/swank.lisp
diff -u slime/swank.lisp:1.161 slime/swank.lisp:1.162
--- slime/swank.lisp:1.161	Tue Apr  6 06:42:53 2004
+++ slime/swank.lisp	Wed Apr  7 05:53:25 2004
@@ -1346,6 +1346,12 @@
           (push symbol completions))))
     (remove-duplicates completions)))
 
+(defun find-matching-packages (name matcher)
+  "Return a list of package names matching NAME."
+  (let ((to-match (string-upcase name)))
+    (remove-if-not #'(lambda (x) (funcall matcher to-match x))
+                   (mapcar #'package-name (list-all-packages)))))
+
 (defun completion-set (string default-package-name matchp)
   (declare (type simple-base-string string))
   (multiple-value-bind (name package-name package internal-p)
@@ -1356,8 +1362,12 @@
                                                 (and (not internal-p)
                                                      package-name)
                                                 matchp)))
+           (packs (and (not package-name)
+                       (find-matching-packages name matchp)))
            (converter (output-case-converter name))
-           (strings (mapcar converter (mapcar #'symbol-name symbols))))
+           (strings
+            (mapcar converter
+                    (nconc (mapcar #'symbol-name symbols) packs))))
       (format-completion-set strings internal-p package-name))))
 
 (defslimefun completions (string default-package-name)





More information about the slime-cvs mailing list