Just Launched: You can now import projects and releases from Google Code onto SourceForge
We are excited to release new functionality to enable a 1-click import from Google Code onto the Allura platform on SourceForge. You can import tickets, wikis, source, releases, and more with a few simple steps. Read More
From: Stephen Compall <s11@me...> - 2008-12-19 22:10:11
In CL-CONT, we expand `defun' into a call to (setf fdefinition), because
we must use a CLOS object in place of an ordinary function. However, we
would also like to allow users to M-. with SLIME to these functions.
I looked in DEFUN, but the only place %DEFUN uses the SOURCE-LOCATION it
creates is warning on redefinition. There is a SB-C::INFO interface I
found, but it does not seem to be for function locations, only locations
of other things.
Is there a slightly stable way I could simulate DEFUN's source location
I write stuff at http://failex.blogspot.com/ now. But the post
formatter and themes are terrible for sharing code, the primary
content, so it might go away sooner or later.
From: Helmut Eller <heller@co...> - 2008-12-20 11:15:13
* Stephen Compall [2008-12-19 22:59+0100] writes:
> Is there a slightly stable way I could simulate DEFUN's source location
I use the macro below to "copy" the source-location from the original
source to the output of macros. It's for CMUCL, but I'm pretty sure the
same works for SBCL too. The "original source" must be the form
(identical with eq) that the compiler reads from the file.
This is primarily intended for precise source-locations in backtraces
(for SBCL, that means debug >= 2). The compiler embeds this kind of
source-location in code objects not in the info db. IOW, this has no
direct effect for M-. on funcallable instances. But it should be
possible to get the code object for the funcallable object and from
there the source-location.
(defmacro at-src-loc ((orig-form) &body new-form)
(destructuring-bind (new-form) new-form
(when (boundp 'c::*source-paths*)
(break "orig-form: ~s -> ~s" orig-form
(gethash orig-form c::*source-paths*))
(setf (gethash new-form c::*source-paths*)
(gethash orig-form c::*source-paths*)))
(defmacro swap-three (x y z)
(defun foo ()
(swap-three (x) (break) (z)) 1)
From: Tobias C. Rittweiler <tcr@fr...> - 2008-12-20 14:34:54
Stephen Compall <s11@...> writes:
> In CL-CONT, we expand `defun' into a call to (setf fdefinition), because
> we must use a CLOS object in place of an ordinary function. However, we
> would also like to allow users to M-. with SLIME to these functions.
Use SB-PCL::DEFINITION-SOURCE-MIXIN, and then expand to
(setf (fdefinition 'foo)
(make-instance 'cl-cont:functionoid ...