[linedit-devel] type error with tab completion

Martin Bähr mbaehr at email.archlab.tuwien.ac.at
Fri Nov 23 02:46:34 UTC 2012


hi,

using my own completer function i get a type error in sbcl or ccl:

(defun complete (key all)
  (let ((match nil))
    (setf match
          (loop for word in all
                when (equal (mismatch key word :test #'string-equal) 
                            (length key))
                collect word))
    (values match (length match))))


(defun tag-completer (key editor)
  (complete key (mapcar #'symbol-name '(CURRENT RESEARCH TEST WEEK-24 WEEK-25 WEEK-26 WRITEUP))))

(defun prompt-read (prompt &optional default &key complete)
  (linedit:linedit :prompt (concatenate 'string prompt ": ")
                   :string (or default "")
                   :complete (or complete (lambda (a b)()))))

(prompt-read "test" "" :complete #'tag-completer)

test: <tab>
CURRENT  RESEARCH TEST     WEEK-24  WEEK-25  WEEK-26  WRITEUP
test: w<tab>
WEEK-24
debugger invoked on a TYPE-ERROR in thread
#<THREAD "main thread" RUNNING {AB36A89}>:
  The value -1 is not of type (MOD 536870909).

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

((FLET #:CLEANUP-FUN-25 :IN LINEDIT:LINEDIT))[:CLEANUP]
0] 

ccl reports
> Error: value -1 is not of the expected type (UNSIGNED-BYTE 24).
> While executing: LINEDIT:LINEDIT, in process listener(1).
> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.
1 > 

greetings, martin.
-- 
cooperative communication with sTeam      -     caudium, pike, roxen and unix
services:   debugging, programming, training, linux sysadmin, web development
--
pike programmer      working in china                 societyserver.(org|net)
foresight developer  community.gotpike.org                 foresightlinux.org
unix sysadmin        (open-steam|www.caudium).org                  realss.com
Martin Bähr          http://societyserver.org/mbaehr/      





More information about the linedit-devel mailing list