1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

* lisp/emacs-lisp/cl-generic.el: Add a method-combination hook.

(cl-generic-method-combination-function): New var.
(cl--generic-lambda): Remove `with-cnm' arg.
(cl-defmethod): Change accordingly.
(cl-generic-define-method): Don't check qualifiers validity.
Preserve all qualifiers in `method-table'.
(cl-generic-call-method): New function.
(cl--generic-nest): Remove (morph into cl-generic-call-method).
(cl--generic-build-combined-method): Adjust to new format of method-table
and use cl-generic-method-combination-function.
(cl--generic-standard-method-combination): New function, extracted from
cl--generic-build-combined-method.
(cl--generic-cnm-sample): Adjust to new format of method-table.

* lisp/emacs-lisp/eieio-compat.el (eieio--defmethod): Use () qualifiers
instead of :primary.

* lisp/emacs-lisp/eieio-datadebug.el (eieio-debug-methodinvoke):
Remove obsolete function.

* test/automated/cl-generic-tests.el (cl-generic-test-11-next-method-p):
New test.
This commit is contained in:
Stefan Monnier 2015-01-26 09:04:55 -05:00
parent 242354a23a
commit 4cdde9196f
6 changed files with 155 additions and 107 deletions

View file

@ -181,7 +181,8 @@ Summary:
(lambda (generic arg &rest args) (apply code arg generic args)))
(_ code))))
(cl-generic-define-method
method (if kind (list kind)) specializers uses-cnm
method (unless (memq kind '(nil :primary)) (list kind))
specializers uses-cnm
(if uses-cnm
(let* ((docstring (documentation code 'raw))
(args (help-function-arglist code 'preserve-names))
@ -201,10 +202,11 @@ Summary:
;; applicable but only of the before/after kind. So if we add a :before
;; or :after, make sure there's a matching dummy primary.
(when (and (memq kind '(:before :after))
;; FIXME: Use `cl-find-method'?
(not (assoc (cons (mapcar (lambda (arg)
(if (consp arg) (nth 1 arg) t))
specializers)
:primary)
nil)
(cl--generic-method-table (cl--generic method)))))
(cl-generic-define-method method () specializers t
(lambda (cnm &rest args)