[slime-devel] Float representation problem

Christian Lynbech christian at defun.dk
Sat Jul 18 05:49:39 UTC 2009


I  just  stumbled  upon  a  problem  with  fuzzy  completion.  This  was
investigated using a  freshly updated slime from CVS  and SBCL 1.0.28 on
an intel mac.

If one adds 

    (setq *read-default-float-format* 'double-float)

to .sbclrc, deletes ~/.slime and then restart the slime session,
completion stops working. One gets an error such as this (in emacs):

    Debugger entered--Lisp error: (error "Format specifier doesn't match argument type")
      format(" %s %-8.2f" "-f--t---" "42.67858333333333d0")
      (insert (format " %s %-8.2f" classification-string score))

Apparently, due to float type differences that I can not quite
understand, the scores reported from the cl side now includes the "d0"
specifier for a single float which emacs then interprets as a symbol
rather than a number.

The problem does not occur when swank is compiled under the normal
default float format, even if the the default is then changed afterwards
again. This means that there is a workaround (just make sure swank
always is compiled with normal float defaults) and changing the default
float format is probably not the most common thing to do and it needs to
coincide with a slime update to trigger the problem.

None the less I guess it hints at a fragility in the moving of floats
between CL and emacs, though I know too little about the slime internals
to say if this is in the generic parts (in which case it probably ought
to be handled) or just in the particulars of the fuzzy completion
contrib.

For reference here is a slightly larger emacs stack trace:

    Debugger entered--Lisp error: (error "Format specifier doesn't match argument type")
      format(" %s %-8.2f" "-f--t---" "42.67858333333333d0")
      (insert (format " %s %-8.2f" classification-string score))
      (let ((start ...) (end)) (insert symbol-name) (setq end (point)) (dolist (chunk chunks) (put-text-property ... ... ... ...)) (put-text-property start (point) (quote mouse-face) (quote highlight)) (dotimes (i ...) (insert " ")) (insert (format " %s %-8.2f" classification-string score)) (insert "\n") (put-text-property start (point) (quote completion) completion))
      (let* ((--cl-rest-- completion) (symbol-name ...) (score ...) (chunks ...) (classification-string ...)) (let (... ...) (insert symbol-name) (setq end ...) (dolist ... ...) (put-text-property start ... ... ...) (dotimes ... ...) (insert ...) (insert "\n") (put-text-property start ... ... completion)))
      (progn (let* (... ... ... ... ...) (let ... ... ... ... ... ... ... ... ...)))
      (destructuring-bind (symbol-name score chunks classification-string) completion (let (... ...) (insert symbol-name) (setq end ...) (dolist ... ...) (put-text-property start ... ... ...) (dotimes ... ...) (insert ...) (insert "\n") (put-text-property start ... ... completion)))
      slime-fuzzy-insert-completion-choice(("member" 42\.67858333333333d0 ((0 "memb")) "-f--t---") 32)



------------------------+-----------------------------------------------------
Christian Lynbech       | christian #\@ defun #\. dk
------------------------+-----------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
                                        - petonic at hal.com (Michael A. Petonic)




More information about the slime-devel mailing list