[slime-cvs] CVS slime

trittweiler trittweiler at common-lisp.net
Thu Feb 28 19:37:57 UTC 2008


Update of /project/slime/cvsroot/slime
In directory clnet:/tmp/cvs-serv13219

Modified Files:
	swank-sbcl.lisp 
Log Message:

This change has been advertized in the Changelog on 2008-02-21.
But it was in fact never committed.


	Fix regressions in the `find-definition' test case on SBCL:

	M-. on e.g. SWANK::READ-FROM-EMACS would bring the user to

	  (|defun read-from-emacs ...)

	and not

	  |(defun read-from-emacs ...)
	
	* swank-sbcl.lisp (source-file-position): Don't 1+ the returned
	position; i.e. return a position usable as a CL /file position/
	which start from 0, and not a position usable in Emacs where
	buffer points start from 1. This is important because the return
	value is passed to SWANK-BACKEND::READ-SNIPPET which invokes
	CL:FILE-POSITION on it.
	(make-definition-source-location): Adapted to 1+ the position
	passed to Emacs, to reflect above change.


--- /project/slime/cvsroot/slime/swank-sbcl.lisp	2008/02/09 18:47:05	1.191
+++ /project/slime/cvsroot/slime/swank-sbcl.lisp	2008/02/28 19:37:57	1.192
@@ -525,7 +525,7 @@
                           `(:position ,(+ pos emacs-position))
                           `(:snippet ,snippet))))
         ((not pathname)
-         `(:error ,(format nil "Source of ~A ~A not found"
+         `(:error ,(format nil "Source definition of ~A ~A not found"
                            (string-downcase type) name)))
         (t
          (let* ((namestring (namestring (translate-logical-pathname pathname)))
@@ -533,7 +533,9 @@
                                            character-offset))
                 (snippet (source-hint-snippet namestring file-write-date pos)))
            (make-location `(:file ,namestring)
-                          `(:position ,pos)
+                          ;; /file positions/ in Common Lisp start
+                          ;; from 0, in Emacs they start from 1.
+                          `(:position ,(1+ pos))
                           `(:snippet ,snippet))))))))
 
 (defun string-path-snippet (string form-path position)
@@ -551,10 +553,10 @@
 (defun source-file-position (filename write-date form-path character-offset)
   (let ((source (get-source-code filename write-date))
         (*readtable* (guess-readtable-for-filename filename)))
-    (1+ (with-debootstrapping
-          (if form-path
-              (source-path-string-position form-path source)
-              (or character-offset 0))))))
+    (with-debootstrapping
+      (if form-path
+          (source-path-string-position form-path source)
+          (or character-offset 0)))))
 
 (defun source-hint-snippet (filename write-date position)
   (let ((source (get-source-code filename write-date)))




More information about the slime-cvs mailing list