[slime-devel] Patch: Fix defmethod arglist when using closer-mop

When inside a package that uses closer-mop, defmethod does not display generic function arglist. Testcase: (defpackage :foo (:use :closer-common-lisp :sb-gray)) (in-package :foo) Type "(defmethod stream-read-char (" into REPL Message area displays: "(defmethod name &body body) Expected result is: "(defmethod stream-read-char (stream) &body body) Fix: *** swank-arglists.lisp.~1.70.~ 2011-06-06 10:02:49.000000000 -0400 --- swank-arglists.lisp 2011-10-02 19:01:11.246673986 -0400 *************** *** 1544,1547 **** --- 1544,1551 ---- (test-print-arglist) (test-arglist-ref) + #+closer-mop + (defmethod arglist-dispatch ((operator (eql 'closer-mop:defmethod)) arguments) + (arglist-dispatch 'cl:defmethod arguments)) + (provide :swank-arglists)

Max Mikhanosha <max@openchat.com> writes:
Message area displays: "(defmethod name &body body) Expected result is: "(defmethod stream-read-char (stream) &body body)
The problem is real, but the fix below may be improved: as it is, it depends on closer-mop being loaded before swank is compiled. We could avoid this unfortunate requirement by looking up closer-mop package dynamically (probably in :around method).
Fix:
[...]
+ #+closer-mop + (defmethod arglist-dispatch ((operator (eql 'closer-mop:defmethod)) arguments) + (arglist-dispatch 'cl:defmethod arguments))
[...] -- Regards, Anton Kovalenko +7(916)345-34-02 | Elektrostal' MO, Russia

Anton Kovalenko wrote:
Max Mikhanosha <max@openchat.com> writes:
Message area displays: "(defmethod name &body body) Expected result is: "(defmethod stream-read-char (stream) &body body)
The problem is real, but the fix below may be improved: as it is, it depends on closer-mop being loaded before swank is compiled. We could avoid this unfortunate requirement by looking up closer-mop package dynamically (probably in :around method).
Redone using around method, works when closer-mop is loaded after slime... See next email also that implements same thing for (def (method flags)) type packages, not for inclusion but just as a snippet if someone has same problem. *** swank-arglists.lisp.~1.70.~ 2011-06-06 10:02:49.000000000 -0400 --- swank-arglists.lisp 2011-10-02 20:29:03.348728948 -0400 *************** *** 1544,1547 **** --- 1544,1556 ---- (test-print-arglist) (test-arglist-ref) + (defmethod arglist-dispatch :around ((operator t) arguments) + (let* ((closer-package (find-package :closer-mop)) + (closer-defmethod (when closer-package + (find-symbol (symbol-name 'cl:defmethod) + closer-package)))) + (if (eq operator closer-defmethod) + (arglist-dispatch 'cl:defmethod arguments) + (call-next-method)))) + (provide :swank-arglists)
participants (2)
-
Anton Kovalenko
-
Max Mikhanosha