[slime-devel] Re: Expand imported symbol with package name
Numeromancer
tschaeffer at dramail.com
Thu Feb 7 14:05:55 UTC 2008
Helmut Eller wrote:
> * Numeromancer [2008-01-30 23:27+0100] writes:
>
>>>> 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?
>
> No, Slime has no such command.
>
> [...]
>> 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.
>
> Would you like to implement something like this?
Yes
> Sending the region (as string) and the name of the current package to
> the Lisp process is very easy. Perhaps it's good enough to READ the
> region in the package (or perhaps some temporary package with suitable
> imports) and pprint the form with clever printer settings. Sending the
> printed result back and inserting it in the buffer is also easy.
>
> Helmut.
>
Something like this, maybe?
(defun slime-eval-region (start end)
"Evaluate region."
(interactive "r")
(slime-eval-with-transcript
`(swank:interactive-expand-symbols
,(buffer-substring-no-properties start end))))
I just need do define swank:interactive-expand-symbols.
I'll look into it. Thanks.
Tim S
More information about the slime-devel
mailing list