CMUCL commit: src/code (unidata.lisp)

Raymond Toy rtoy at common-lisp.net
Mon Sep 20 03:17:14 CEST 2010


    Date: Sunday, September 19, 2010 @ 21:17:14
  Author: rtoy
    Path: /project/cmucl/cvsroot/src/code

Modified: unidata.lisp

Was mishandling the case where there are no more completions.  In this
case we were returning the prefix string, but that would be incorrect
if the prefix string is not a valid character.  So check that it is
valid and return it.  Otherwise do nothing (thereby returning nil) so
slime can note the character is invalid.


--------------+
 unidata.lisp |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)


Index: src/code/unidata.lisp
diff -u src/code/unidata.lisp:1.20 src/code/unidata.lisp:1.21
--- src/code/unidata.lisp:1.20	Sun Sep 19 20:59:22 2010
+++ src/code/unidata.lisp	Sun Sep 19 21:17:14 2010
@@ -4,7 +4,7 @@
 ;;; This code was written by Paul Foley and has been placed in the public
 ;;; domain.
 ;;; 
-(ext:file-comment "$Header: /project/cmucl/cvsroot/src/code/unidata.lisp,v 1.20 2010-09-20 00:59:22 rtoy Exp $")
+(ext:file-comment "$Header: /project/cmucl/cvsroot/src/code/unidata.lisp,v 1.21 2010-09-20 01:17:14 rtoy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -18,7 +18,7 @@
 
 (defconstant +unidata-path+ #p"ext-formats:unidata.bin")
 
-(defvar *unidata-version* "$Revision: 1.20 $")
+(defvar *unidata-version* "$Revision: 1.21 $")
 
 (defstruct unidata
   range
@@ -1291,7 +1291,12 @@
 		   (if suffixes
 		       (loop for n in suffixes
 			  do (push (concatenate 'string full-prefix n) names))
-		       (push full-prefix names))))))
+		       ;; No suffixes.  So either the prefix is the
+		       ;; only possible completion or it's not valid.
+		       ;; Figure that out.  If it's valid, add it to
+		       ;; names.
+		       (when (search-dictionary (string-upcase prefix-tail) dictionary)
+			 (push prefix-match names)))))))
 	;; Match prefix for Hangul syllables or CJK unified ideographs.
 	(cond ((char= (char prefix-match 0) #\H)
 	       ;; Add "Hangul_Syllable_" as possible completion for
@@ -1312,7 +1317,8 @@
 		 (unless *cjk-unified-ideograph-dictionary*
 		   (build-cjk-unified-ideograph-dictionary))
 		 (han-or-cjk-completion prefix-match "Cjk_Unified_Ideograph-"
-					*cjk-unified-ideograph-dictionary*)))))
+					*cjk-unified-ideograph-dictionary*)
+		 ))))
       (setf names (mapcar #'string-capitalize names))
       ;;(format t "Final names = ~S~%" names)
       names)))



More information about the cmucl-commit mailing list