[slime-devel] Re: Expand imported symbol with package name
tschaeffer at dramail.com
Wed Jan 16 21:17:30 UTC 2008
Tobias C. Rittweiler wrote:
> Numeromancer <tschaef at sbcglobal.net> writes:
>> Does slime have a function which will qualify the symbol at point with
>> its package name if it is imported? And the obvious extension,
>> qualifying all symbols in the region or file? Does anyone have any
>> hints on how one might create such a function?
> What do you mean with "if it is imported"? Do you really only mean if
> the symbol was imported via IMPORT or via the :IMPORT-FROM clause of
> DEFPACKAGE? What do you want this for?
Sorry about the delay.
Perhaps "imported" is not technically correct. "Available in the current
package without qualification" might be better. Or not.
I mean this: if I am in package foo, which uses cl, for example, then
(map 'func-in-foo (list 1 2 3 var-in-foo))
would be transformed to
(cl:map 'func-in-foo (cl:list 1 2 3 var-in-foo))
if the whole expression were in the region. The symbols in the current
package are not qualified. Or, the package name is an argument and only
symbols in that package are so qualified.
This would help in finding details of the dependencies between packages.
E.g.: If I have a utils package (don't we all?) and another package, foo
maybe, and I want to split the latter off into a separate project, I may
want to see if I can easily make it independent of utils. Macroexpanding
will show me this, but if Slime could do as I suggest I could change the
buffer and then one-by-one change the use of objects in util to
something else, and thereby remove any dependency on the util package.
Or, similarly, I might want to continue to use utils in foo but not :use
it, and so force all symbols from utils to have package qualifiers. I
could then :use instead some new package that has symbols which conflict
with symbols in utils.
I hope this is clear.
These are not everyday tasks, but they can be tedious, and what I have
suggested would help.
More information about the slime-devel