[slime-devel] Small improvement in symbol-completion

Antonio Menezes Leitao aml at gia.ist.utl.pt
Tue Feb 22 18:19:10 UTC 2005


While I'm working at the REPL, I sometimes need to use symbols that
are not present in the current package.  In this case, the
slime-complete-symbol* function cannot complete the symbol at point.

Here I propose a small change in slime.el in order to ask the user
whether he/she wants to try completions in different packages.

<     (if (null completion-set)
<         (progn (slime-minibuffer-respecting-message
>     (if (and (null completion-set)
>              (if (y-or-n-p (format "Can't find completion for \"%s\" in the current package. Search other packages?" prefix))
>                (dolist (package (slime-eval `(swank:list-all-package-names t)) t)
>                  (setq completion-result (slime-completions (format "%s::%s" package prefix))
>                        completion-set (first completion-result)
>                        completed-prefix (second completion-result))
>                  (when completion-set
>                    (return nil)))
>                t))
>         (progn (slime-minibuffer-respecting-message 

I used it, mainly, to "automagically" insert the package qualifier on
a given function call.

It works but it could be improved.  The problem is that it stops
searching packages as soon as one of them returns some completions.  I
tried to adapt it to present the user with all possible completions in
all packages but the format of the slime-completions returned values
and the use of the completed-prefix variable (that assumes that
there's only one package) makes this a bit harder.

So, before I start making some more serious changes, I would like to
know if anyone thinks this is sufficiently useful to deserve more time

Best regards,

António Leitão.

Ps: on the Explorer Lisp Machine, this was _very_ useful when we were
debugging large systems.  But the behaviour wasn't exactly like this:
IIRC, it was implemented using restarts.

More information about the slime-devel mailing list