Hi all,
I encountered a construct like the following in cl-irc. It makes the
source path finder in M-. break:
------------- C-c C-k, then M-. A RET ------------
(cl:defpackage :swank-bork
(:use :cl))
(cl:in-package :swank-bork)
(eval-when (:compile-toplevel :load-toplevel :execute)
(defvar *foo* '(a b c)))
(defmacro define-foos (args)
`(progn
,@(mapcar (lambda (arg)
`(defun ,arg (,arg) ,arg))
args)))
(define-foos #.*foo*)
------------- snip ------------
trying to M-. A or B or C will fail with "Error: The variable *FOO* is
unbound."
With Juho Snellman's help, I tracked this down to
swank::read-source-form. My current suspicion on why this is happening
is that it READs the form and doesn't bind *package* to the package
that the stream uses. This causes evaluation of the #. form to yield
bad results.
Unfortunately, I have no idea how to fix this, or if this is
fix-worthy at all. I guess read-source-form would have to try and find
a top-level in-package form somewhere, possibly expanding macros along
the way and digging into top-levelness preserving forms like eval-when
and progn. That would be a lot of work for this one error, in my eyes.
Thanks for any advice (or fixes (-8),
--
Andreas Fuchs, <asf(a)boinkor.net>, asf(a)jabber.at, antifuchs