[slime-devel] (def (method ...)) arglist

Max Mikhanosha max at openchat.com
Mon Oct 3 00:42:27 UTC 2011

For folks using cl-def, definer, and other packages that have the (def
(method flags) method-name) syntax, the following snippet added to
~/.swank.lisp will start using method arguments in the message
area. Replace demacs:def with the correct package name, if you are not
using demacs.

(swank:swank-require :swank-arglists)
(in-package :swank)

(defmethod arglist-dispatch ((operator (eql 'demacs:def)) arguments)
  (flet ((is-method (elem)
           (or (eq elem 'method)
               (and (consp elem)
                    (eq (car elem) 'method)))))
    (match (cons operator arguments)
      (('demacs:def (#'is-method elem) (#'function-exists-p gf-name) . rest)
       (let ((gf (fdefinition gf-name)))
         (when (typep gf 'generic-function)
           (with-available-arglist (arglist) (decode-arglist (arglist gf))
             (let ((qualifiers (loop for x in rest
                                  until (or (listp x) (empty-arg-p x))
                                  collect x)))
               (return-from arglist-dispatch
                 (make-arglist :provided-args `(method ,gf-name , at qualifiers)
                               :required-args `(,arglist)
                               :rest "body" :body-p t)))))))
      (_))                              ; Fall through

More information about the slime-devel mailing list