[slime-devel] Small fix for swank-lispworks

Antonio Menezes Leitao aml at gia.ist.utl.pt
Sun Feb 4 18:15:58 UTC 2007


Hi,

The file swank-lispworks contains a function named dspec-file-position
that, in recent LispWorks versions, reads forms from a file.

The problem is that the file might contain #. forms that might refer
to *compile-file-pathname* or *compile-file-truename*, or
*load-pathname* or *load-truename*.  In order to "emulate" the
compilation or loading process, this function must also provide values
to those variables so that the forms can be properly read.  My quick
fix is:

(defun dspec-file-position (file dspec)
  (let ((*compile-file-pathname* (pathname file))
        (*compile-file-truename* (truename file)))
    (let ((*load-pathname* *compile-file-pathname*)
          (*load-truename* *compile-file-truename*))
      (with-open-file (stream file)
        (let ((pos 
               #-(or lispworks4.1 lispworks4.2)
               (dspec-stream-position stream dspec)))
          (if pos
            (list :position (1+ pos) t)
            (dspec-buffer-position dspec 1)))))))

Best regards,

António Leitão.



More information about the slime-devel mailing list