[slime-devel] hook around eval-for-emacs

Anton Vodonosov avodonosov at yandex.ru
Tue Jan 15 16:34:07 UTC 2013


Hello.

Could you add a hook around eval-for-emacs, as show in the attached patch?
It would allow maintain custom context for all the slime requests.

My use case is that I have this tool: https://github.com/avodonosov/local-package-aliases.
It allows me to say that in my package $a:plist-alist means alexandria:plist-alist

It is portable and in my opinion convenient, but as the aliases are handled by reader macro,
slime does not understand tokens like $a:plist-alist, because it can't find package $a.
In result slime completion, function arguments hints, go-to-definition doesn't work.

The solution I found is that during evaluation of any slime request, 
if the package designated by swank::*buffer-package* has alias mapping,
I temporary add all these aliases as nicknames to the corresponding packages.

That's why I need a hook around evaluation
of every expression received by swank::eval-for-emacs.

With the swank patch applied, I add this hook:

  (defun swank-eval-for-emacs-hook (next-fn)
    (local-package-aliases::call-with-nicknames (local-package-aliases::alias-table-for swank::*buffer-package*)
                                                next-fn))

  (push 'swank-eval-for-emacs-hook swank::*around-eval-for-emacs-hook*)

and slime completion, go-to-definition, function parameters hints all start working.


Best regards,
- Anton



-------------- next part --------------
A non-text attachment was scrubbed...
Name: around-eval-for-emacs-hook.diff
Type: application/octet-stream
Size: 3490 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/slime-devel/attachments/20130115/cd29c5ae/attachment.obj>


More information about the slime-devel mailing list