[slime-devel] [PATCH] completions-for-keyword: better handling when arglist is unavailable

Tobias C. Rittweiler tcr at freebits.de
Fri Dec 18 08:48:52 UTC 2009


Ariel Badichi <vermilionrush at gmail.com> writes:

> ---
>  contrib/swank-arglists.lisp |   17 ++++++++++-------
>  1 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/contrib/swank-arglists.lisp b/contrib/swank-arglists.lisp
> index fcc3551..4873091 100644
> --- a/contrib/swank-arglists.lisp
> +++ b/contrib/swank-arglists.lisp
> @@ -1150,14 +1150,17 @@ wrapped in ===> X <===."
>    "Return a list of possible completions for KEYWORD-STRING relative
>  to the context provided by RAW-FORM."
>    (with-buffer-syntax ()
> -    (with-available-arglist (arglist)
> -        (find-immediately-containing-arglist (parse-raw-form raw-form))
>        ;; It would be possible to complete keywords only if we are in
>        ;; a keyword position, but it is not clear if we want that.
> -      (let* ((keywords
> -              (append (mapcar #'keyword-arg.keyword
> -                              (arglist.keyword-args arglist))
> -                      (remove-if-not #'keywordp (arglist.any-args arglist))))
> +      (let* ((keywords-for-arglist
> +              (with-available-arglist (arglist)
> +                  (find-immediately-containing-arglist (parse-raw-form raw-form))
> +                (append (mapcar #'keyword-arg.keyword
> +                                (arglist.keyword-args arglist))
> +                        (remove-if-not #'keywordp (arglist.any-args arglist)))))
> +             (keywords
> +              (unless (eq :not-available keywords-for-arglist)
> +                keywords-for-arglist))
>               (keyword-name
>                (tokenize-symbol keyword-string))
>               (matching-keywords
> @@ -1170,7 +1173,7 @@ to the context provided by RAW-FORM."
>               (completion-set
>                (format-completion-set strings nil "")))
>          (list completion-set
> -              (longest-compound-prefix completion-set))))))
> +              (longest-compound-prefix completion-set)))))
>  
>  (defparameter +cursor-marker+ '%cursor-marker%)

Do rather: (let ((arglist (find-immediately-containing-arglist ...)))
             (when (arglist-available-p arglist)
               ...original-body..))

Also add a test case to the`complete-symbol*' test in slime-c-p-c.el

  -T.





More information about the slime-devel mailing list