[slime-devel] Re: Daily ChangeLog diff

Tobias C. Rittweiler tcr at freebits.de
Thu Feb 21 11:49:39 UTC 2008


mbaringer at common-lisp.net (Marco Baringer) writes:

> Index: slime/ChangeLog
> diff -u slime/ChangeLog:1.1291 slime/ChangeLog:1.1293
> --- slime/ChangeLog:1.1291	Sun Feb 17 07:28:27 2008
> +++ slime/ChangeLog	Wed Feb 20 17:12:37 2008
> @@ -1,3 +1,41 @@
> +2008-02-20  Helmut Eller  <heller at common-lisp.net>
> +
> +	Better factorization for M-. and xref commands.
> +
> +	* slime.el (slime-xref): Renamed from slime-definition.
> +	(slime-location, slime-location-p): New ADT def.
> +	(slime-xref-has-location-p, slime-analyze-xrefs): New functions.
> +	This work used to be done on the Lisp side.
> +	(slime-pop-to-location): New function.
> +	(slime-edit-definition, slime-edit-definition-cont): Simplified.
> +	(slime-find-definitions): New function.
> +	(slime-goto-definition, slime-goto-definition-other-window)
> +	(slime-pop-to-other-window, slime-show-definitions): Deleted.
> +	(slime-insert-xrefs): Simplified.
> +	(slime-insert-xref-location): Deleted. No need to show the filename
> +	twice.

Nice work! Do you mind the following patch? In the xref buffer, it'll
make the source of definitions that came from interactively defining
(i.e. C-c C-c) more explicit.

It'll display them as

  #<buffer foo.lisp>
    (DEFMETHOD QUUX T T)

instead of

  foo.lisp
    (DEFMETHOD QUUX T T)

I consider it to be useful to directly see that some definition was done
interactively, especially when working with a long-living image. (ATM
you can only deduce this from the fact that definitions from files most
likely result in absolute paths.)

  -T.



Index: slime.el
===================================================================
RCS file: /project/slime/cvsroot/slime/slime.el,v
retrieving revision 1.906
diff -u -r1.906 slime.el
--- slime.el    20 Feb 2008 22:12:37 -0000      1.906
+++ slime.el    21 Feb 2008 11:37:38 -0000
@@ -5189,11 +5189,19 @@
         (slime-alistify xrefs
                         (lambda (x)
                           (if (slime-xref-has-location-p x)
-                              (cadr
-                               (slime-location.buffer (slime-xref.location x)))
+                              (slime-location-to-string (slime-xref.location x))
                             "Error"))
                         #'equal)))
 
+(defun slime-location-to-string (location)
+  (destructure-case (slime-location.buffer location)
+    ((:file filename) filename)
+    ((:buffer bufname)
+     (let ((buffer (get-buffer bufname)))
+       (if buffer 
+           (format "%S" buffer) ; "#<buffer foo.lisp>"
+           (format "%s (previously existing buffer)" bufname))))))
+
 (defun slime-pop-to-location (location &optional where)
   (ecase where
     ((nil)




More information about the slime-devel mailing list