* lisp/emacs-lisp/edebug.el (edebug--handle-&-spec-op <&name>): New method
(edebug--concat-name): New function. (edebug-match-name, edebug-match-cl-generic-method-qualifier) (edebug-match-cl-generic-method-args): Delete functions. * doc/lispref/edebug.texi (Specification List): Document it. * lisp/emacs-lisp/cl-generic.el (cl-defgeneric): Use `&name`. (cl-generic--method-qualifier-p): New predicate. (cl-defmethod): Use it and `&name`. * lisp/emacs-lisp/cl-macs.el (cl-defun, cl-iter-defun, cl-flet): * lisp/emacs-lisp/eieio-compat.el (defmethod): * lisp/emacs-lisp/gv.el (gv-define-setter): * lisp/emacs-lisp/ert.el (ert-deftest): Use `&name`. * lisp/erc/erc-backend.el (define-erc-response-handler): Use `declare` and `&name`.
This commit is contained in:
parent
e81cf63be1
commit
2007afd21b
9 changed files with 111 additions and 84 deletions
|
@ -206,22 +206,29 @@ DEFAULT-BODY, if present, is used as the body of a default method.
|
|||
\(fn NAME ARGS [DOC-STRING] [OPTIONS-AND-METHODS...] &rest DEFAULT-BODY)"
|
||||
(declare (indent 2) (doc-string 3)
|
||||
(debug
|
||||
(&define [&or name ("setf" name :name setf)] listp
|
||||
lambda-doc
|
||||
(&define [&name sexp] ;Allow (setf ...) additionally to symbols.
|
||||
listp lambda-doc
|
||||
[&rest [&or
|
||||
("declare" &rest sexp)
|
||||
(":argument-precedence-order" &rest sexp)
|
||||
(&define ":method"
|
||||
;; FIXME: The `:unique'
|
||||
;; FIXME: The `gensym'
|
||||
;; construct works around
|
||||
;; Bug#42672. We'd rather want
|
||||
;; names like those generated by
|
||||
;; `cl-defmethod', but that
|
||||
;; requires larger changes to
|
||||
;; Edebug.
|
||||
:unique "cl-generic-:method@"
|
||||
[&rest cl-generic-method-qualifier]
|
||||
cl-generic-method-args lambda-doc
|
||||
[&name "cl-generic-:method@" []]
|
||||
[&name [] gensym] ;Make it unique!
|
||||
[&name
|
||||
[[&rest cl-generic--method-qualifier-p]
|
||||
;; FIXME: We don't actually want the
|
||||
;; argument's names to be considered
|
||||
;; part of the name of the defined
|
||||
;; function.
|
||||
listp]] ;Formal args
|
||||
lambda-doc
|
||||
def-body)]]
|
||||
def-body)))
|
||||
(let* ((doc (if (stringp (car-safe options-and-methods))
|
||||
|
@ -398,6 +405,9 @@ the specializer used will be the one returned by BODY."
|
|||
(let ((combined-doc (buffer-string)))
|
||||
(if ud (help-add-fundoc-usage combined-doc (car ud)) combined-doc)))))
|
||||
|
||||
(defun cl-generic--method-qualifier-p (x)
|
||||
(not (listp x)))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro cl-defmethod (name args &rest body)
|
||||
"Define a new method for generic function NAME.
|
||||
|
@ -440,15 +450,17 @@ The set of acceptable TYPEs (also called \"specializers\") is defined
|
|||
(declare (doc-string 3) (indent defun)
|
||||
(debug
|
||||
(&define ; this means we are defining something
|
||||
[&or name ("setf" name :name setf)]
|
||||
;; ^^ This is the methods symbol
|
||||
[ &rest cl-generic-method-qualifier ]
|
||||
;; Multiple qualifiers are allowed.
|
||||
cl-generic-method-args ; arguments
|
||||
[&name [sexp ;Allow (setf ...) additionally to symbols.
|
||||
;; Multiple qualifiers are allowed.
|
||||
[&rest cl-generic--method-qualifier-p]
|
||||
;; FIXME: We don't actually want the argument's names
|
||||
;; to be considered part of the name of the
|
||||
;; defined function.
|
||||
listp]] ; arguments
|
||||
lambda-doc ; documentation string
|
||||
def-body))) ; part to be debugged
|
||||
(let ((qualifiers nil))
|
||||
(while (not (listp args))
|
||||
(while (cl-generic--method-qualifier-p args)
|
||||
(push args qualifiers)
|
||||
(setq args (pop body)))
|
||||
(when (eq 'setf (car-safe name))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue