[slime-devel] Finding source of functions compiled with slime-compile-defun.

Again, having not looked into it in any great detail, is there any way to communicate source location back to Lisp so it can find the source of functions compiled with C-c C-c? -Peter -- Peter Seibel peter@javamonkey.com Lisp is the red pill. -- John Fraser, comp.lang.lisp

Peter Seibel <peter@javamonkey.com> writes:
Again, having not looked into it in any great detail, is there any way to communicate source location back to Lisp so it can find the source of functions compiled with C-c C-c?
excl::*source-pathname* seems to be the right place for Allegro CL. I committed some code to set this variable when compiling with C-c C-c. Helmut.

Helmut Eller <e9626484@stud3.tuwien.ac.at> writes:
Peter Seibel <peter@javamonkey.com> writes:
Again, having not looked into it in any great detail, is there any way to communicate source location back to Lisp so it can find the source of functions compiled with C-c C-c?
excl::*source-pathname* seems to be the right place for Allegro CL. I committed some code to set this variable when compiling with C-c C-c.
Cool. Thanks. -Peter -- Peter Seibel peter@javamonkey.com Lisp is the red pill. -- John Fraser, comp.lang.lisp

Helmut Eller <e9626484@stud3.tuwien.ac.at> writes:
Peter Seibel <peter@javamonkey.com> writes:
Again, having not looked into it in any great detail, is there any way to communicate source location back to Lisp so it can find the source of functions compiled with C-c C-c?
excl::*source-pathname* seems to be the right place for Allegro CL. I committed some code to set this variable when compiling with C-c C-c.
So I finally got around to checking out this change. Looks good except I still get warnings from Allegro about redefining a function when I use C-c C-c after, say C-c C-k. Poking around a bit it seems that the problem is the location gets set differently by COMPILE-FILE and your code. The patch below makes two changes--when the buffer we are compiling from is a file buffer we pass the full filename rather than just the buffer name and we take of the character position. It seems to work with Allegro 6.2 but I don't know if there's some other reason that the buffer passed to swank:compile-string-for-emacs should be just the buffer name. If not I'd like to commit this. -Peter Index: slime.el =================================================================== RCS file: /project/slime/cvsroot/slime/slime.el,v retrieving revision 1.388 diff -u -r1.388 slime.el --- slime.el 5 Aug 2004 15:18:32 -0000 1.388 +++ slime.el 8 Aug 2004 22:16:27 -0000 @@ -3096,7 +3096,7 @@ (defun slime-compile-string (string start-offset) (slime-eval-async - `(swank:compile-string-for-emacs ,string ,(buffer-name) ,start-offset) + `(swank:compile-string-for-emacs ,string ,(or (buffer-file-name) (buffer-name)) ,start-offset) (slime-compilation-finished-continuation))) (defvar slime-hide-style-warning-count-if-zero t) Index: swank-allegro.lisp =================================================================== RCS file: /project/slime/cvsroot/slime/swank-allegro.lisp,v retrieving revision 1.49 diff -u -r1.49 swank-allegro.lisp --- swank-allegro.lisp 4 Aug 2004 17:17:55 -0000 1.49 +++ swank-allegro.lisp 8 Aug 2004 22:16:27 -0000 @@ -252,7 +252,7 @@ `(in-package ,(package-name *package*)) `(eval-when (:compile-toplevel :load-toplevel) (setq excl::*source-pathname* - (format nil "~A:~D" ',buffer ',position))) + (format nil "~A" ',buffer))) string))))) ;;;; Definition Finding -- Peter Seibel peter@javamonkey.com Lisp is the red pill. -- John Fraser, comp.lang.lisp

Peter Seibel <peter@javamonkey.com> writes:
Helmut Eller <e9626484@stud3.tuwien.ac.at> writes:
Peter Seibel <peter@javamonkey.com> writes:
Again, having not looked into it in any great detail, is there any way to communicate source location back to Lisp so it can find the source of functions compiled with C-c C-c?
excl::*source-pathname* seems to be the right place for Allegro CL. I committed some code to set this variable when compiling with C-c C-c.
So I finally got around to checking out this change. Looks good except I still get warnings from Allegro about redefining a function when I use C-c C-c after, say C-c C-k. Poking around a bit it seems that the problem is the location gets set differently by COMPILE-FILE and your code. The patch below makes two changes--when the buffer we are compiling from is a file buffer we pass the full filename rather than just the buffer name and we take of the character position. It seems to work with Allegro 6.2 but I don't know if there's some other reason that the buffer passed to swank:compile-string-for-emacs should be just the buffer name. If not I'd like to commit this.
Currently excl::*source-pathname* is being used in a hacky way to record the buffer and position that a definition was C-cC-c'd in, so that M-. can later extract/parse this information by way of find-fspec-location. Thus the "<buffername>:<position>" format is significant because it gets parsed back. So your patch would muffle the warning at the expense of breaking M-. since it records only filename rather than buffer and position. Seems to me the ideal would be to find a different way to record the source location instead of encoding it into the "pathname" string. Failing that perhaps another kludge is needed to muffle this warning.. -Luke
participants (3)
-
Helmut Eller
-
Luke Gorrie
-
Peter Seibel