[slime-cvs] CVS slime/contrib

trittweiler trittweiler at common-lisp.net
Thu Jan 10 00:39:37 UTC 2008


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

Modified Files:
	swank-fuzzy.lisp 
Log Message:

* slime-fuzzy.el (slime-fuzzy-completion-time-limit-in-msec):
  Update docstring: Its value isn't rounded to nearest second, but
  is really interpreted as msecs.

* swank-fuzzy.el: Updated some comments.
  (fuzzy-generate-matchings): Sort package matchings before
  traversal, such that they're traversed in the order of their
  score. (Important with time limit exhausts during traversal.)


--- /project/slime/cvsroot/slime/contrib/swank-fuzzy.lisp	2007/09/15 22:21:21	1.6
+++ /project/slime/cvsroot/slime/contrib/swank-fuzzy.lisp	2008/01/10 00:39:37	1.7
@@ -220,15 +220,20 @@
 	       ;; relative to all the packages found.
 	       (multiple-value-bind (found-packages rest-time-limit)
 		   (find-packages parsed-package-name time-limit-in-msec)
+		 ;; We want to traverse the found packages in the order of their score,
+		 ;; since those with higher score presumably represent better choices.
+		 ;; (This is important because some packages may never be looked at if
+		 ;;  time limit exhausts during traversal.)
+		 (setf found-packages (sort found-packages #'fuzzy-matching-greaterp))
 		 (loop
 		       for package-matching across found-packages
 		       for package = (find-package (fuzzy-matching.package-name package-matching))
 		       while (or (not time-limit) (> rest-time-limit 0)) do
 		         (multiple-value-bind (matchings remaining-time)
-			     ;; The filter removes all those symbols which are also present
-			     ;; in one of the other packages, specifically if such a package
-			     ;; represents the home package of the symbol, because that one
-			     ;; is deemed to be the best match.
+			     ;; The duplication filter removes all those symbols which are
+			     ;; present in more than one package match. Specifically if such a
+			     ;; package match represents the home package of the symbol, it's
+			     ;; the one kept because this one is deemed to be the best match.
 			     (find-symbols parsed-symbol-name package rest-time-limit
 					   (%make-duplicate-symbols-filter
 					    (remove package-matching found-packages)))
@@ -261,9 +266,9 @@
 	(* 1000 (* comparasions (expt 10 -7)))))) ; msecs
 
 (defun %make-duplicate-symbols-filter (fuzzy-package-matchings)
-  ;; Returns a filter function that takes a symbol and which returns T
-  ;; only if no matching in FUZZY-PACKAGE-MATCHINGS represents the
-  ;; home-package of the.
+  ;; Returns a filter function that takes a symbol, and which returns T
+  ;; if and only if /no/ matching in FUZZY-PACKAGE-MATCHINGS represents
+  ;; the home-package of the symbol passed.
   (let ((packages (mapcar #'(lambda (m)
 			      (find-package (fuzzy-matching.package-name m)))
 			  (coerce fuzzy-package-matchings 'list))))
@@ -285,7 +290,7 @@
 		 (name2 (symbol-name (fuzzy-matching.symbol m2))))
 	     (string< name1 name2))))))
 
-
+(declaim (ftype (function () (integer 0)) get-real-time-msecs))
 (defun get-real-time-in-msecs ()
   (let ((units-per-msec (max 1 (floor internal-time-units-per-second 1000))))
     (values (floor (get-internal-real-time) units-per-msec)))) ; return just one value!




More information about the slime-cvs mailing list