Recently, slime and SBCL have stopped collaborating to correctly place compiler notes in source buffers. For example, I compile this function with C-c C-c:
(defun funk (x) (+ 1 'x))
The generated notes are stuck on the arglist of the form. If I use cmucl, for example, all the notes are correctly placed.
What should I do?
Zach
Zach Beane xach@xach.com writes:
Recently, slime and SBCL have stopped collaborating to correctly place compiler notes in source buffers. For example, I compile this function with C-c C-c:
(defun funk (x) (+ 1 'x))
The generated notes are stuck on the arglist of the form. If I use cmucl, for example, all the notes are correctly placed.
What should I do?
I dug into this, and it looks like
(reverse (sb-c::compiler-error-context-original-source-path context))
has a spurious second element. That is, for the bogus code above, the note about 'X not being an integer has a path of (0 2 3 2), when the correct path is (0 3 2). The note about the variable X being defined but never used gives a path of (0 2), but the correct path is (0). I updated swank-sbcl.lisp to simply remove the second element of the source path, and the annotations now show up in the right place.
However, this seems like it could be a problem in SBCL's source path generation, and not something to patch over in slime. I'm not sure how the compiler-error-context-original-source-path gets populated. Any SBCL hacker have an idea? Why does it get the extra path part?
Zach
Here is a SLIME patch from Juho Snellman that fixes the annotation problems (misplaced annotations, "FOO is not of type LIST") currently affecting recent SLIME and SBCL.
Zach
? jsnell.patch Index: ChangeLog =================================================================== RCS file: /project/slime/cvsroot/slime/ChangeLog,v retrieving revision 1.725 diff -u -r1.725 ChangeLog --- ChangeLog 24 Jul 2005 15:30:46 -0000 1.725 +++ ChangeLog 26 Jul 2005 14:34:24 -0000 @@ -1,3 +1,9 @@ +2005-07-26 Zach Beane xach@xach.com + + * swank-sbcl.lisp (swank-compile-string): Revert to old string + compilation behavior to fix compiler note annotations. Code from + Juho Snellman. + 2005-07-24 Tom Pierce tlpierce@gmail.com
* swank.lisp (format-iso8601-time): New functions. Properly Index: swank-sbcl.lisp =================================================================== RCS file: /project/slime/cvsroot/slime/swank-sbcl.lisp,v retrieving revision 1.137 diff -u -r1.137 swank-sbcl.lisp --- swank-sbcl.lisp 5 Jul 2005 20:30:59 -0000 1.137 +++ swank-sbcl.lisp 26 Jul 2005 14:34:24 -0000 @@ -304,7 +304,8 @@ ;; Compiling from a buffer (let ((position (+ *buffer-offset* (source-path-string-position - source-path *buffer-substring*)))) + (cons 0 (nthcdr 2 source-path)) + *buffer-substring*)))) (make-location (list :buffer *buffer-name*) (list :position position)))) ((and (pathnamep file) (null *buffer-name*)) @@ -465,8 +466,12 @@ (list :emacs-buffer buffer :emacs-string string :emacs-position position)) - (with-input-from-string (s string) - (load s)))))) + #+nil + (with-input-from-string (stream string) + (load stream)) + (funcall (compile nil + `(lambda () + ,(read-from-string string))))))))
;;;; Definitions
Zach Beane xach@xach.com writes:
Here is a SLIME patch from Juho Snellman that fixes the annotation problems (misplaced annotations, "FOO is not of type LIST") currently affecting recent SLIME and SBCL.
applied. thanks.