[slime-devel] [PATCH] Fix TOKENIZE-SYMBOL (and regression from previous patches.)

Tobias C. Rittweiler tcr at freebits.de
Sat Mar 3 13:40:58 EST 2007


This fixes a regression introduced by my last patches:

The way how TOKENIZE-SYMBOL considers a given string (representing a
symbol) to be internal, was not broad enough. This broke fuzzy
completion with my latest patches when you're in a package that includes
another package (:CL for instance) and try to fuzzy-complete a symbol
inherited from that other package (e.g. MULTIPLE-VALUE-BIND.) That case
didn't come up when testing the previous patches.

  -T.

-------------- next part --------------
--- ../slime-hacked-2/ChangeLog	2007-03-03 16:18:18.000000000 +0100
+++ ChangeLog	2007-03-03 19:31:48.000000000 +0100
@@ -1,5 +1,17 @@
 2007-03-03  Tobias C. Rittweiler <tcr at freebits.de>
 
+	* swank.lisp (tokenize-symbol, tokenize-symbol-thoroughly):
+	Previously these functions said a string representing a symbol is
+	internal exactly if it contained "::" as substring. Now they say
+	additionally so for symbols without any package identifier, as
+	they are internal to am implicit current package. (Otherwise
+	will break fuzzy completion.
+
+	* swank.lisp (format-completion-result): Fixed formation
+	for the case that PACKAGE-NAME is NIL but INTERNAL-P is T.
+
+2007-03-03  Tobias C. Rittweiler <tcr at freebits.de>
+
 	* swank.lisp: Making fuzzy completion semantically right from a
 	user perspective. As an example on SBCL, "sb:with- C-c M-i" will
 	display all exported "with"-style macros in all sb-* packages from
--- ../slime-hacked-2/swank.lisp	2007-03-03 15:45:08.000000000 +0100
+++ swank.lisp	2007-03-03 19:23:41.000000000 +0100
@@ -1366,7 +1366,7 @@
                    (if pos (subseq string 0 pos) nil)))
         (symbol (let ((pos (position #\: string :from-end t)))
                   (if pos (subseq string (1+ pos)) string)))
-        (internp (search "::" string)))
+        (internp (not (find ":" string))))
     (values symbol package internp)))
 
 (defun tokenize-symbol-thoroughly (string)
@@ -1397,7 +1397,7 @@
                                          :fill-pointer 0))))
             (t
              (vector-push-extend (casify-char char) token))))
-    (values token package internp)))
+    (values token package (or (not package) internp))))
 
 (defun casify-char (char)
   "Convert CHAR accoring to readtable-case."
@@ -3331,9 +3331,9 @@
           (sort strings #'string<)))
 
 (defun format-completion-result (string internal-p package-name)
-  (let ((prefix (cond (internal-p (format nil "~A::" package-name))
-                      (package-name (format nil "~A:" package-name))
-                      (t ""))))
+  (let ((prefix (cond ((not package-name) "")
+                      (internal-p (format nil "~A::" package-name))
+                      (t (format nil "~A:" package-name)))))
     (values (concatenate 'string prefix string)
             (length prefix))))
 


More information about the slime-devel mailing list