1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

* lisp/subr.el (method-files): Move function to cl-generic.el

* lisp/emacs-lisp/cl-generic.el (cl-generic-p): New function.
(cl--generic-method-files): New function, moved from subr.el.
* lisp/emacs-lisp/edebug.el (edebug-instrument-function): Use them.
* test/lisp/emacs-lisp/cl-generic-tests.el:
* test/lisp/subr-tests.el: Move and adjust method-files tests accordingly.
This commit is contained in:
Stefan Monnier 2017-07-28 11:28:48 -04:00
parent dc9c6a071c
commit b2225a374f
6 changed files with 46 additions and 46 deletions

View file

@ -166,6 +166,10 @@ SPECIALIZERS-FUNCTION takes as first argument a tag value TAG
(defmacro cl--generic (name)
`(get ,name 'cl--generic))
(defun cl-generic-p (f)
"Return non-nil if F is a generic function."
(and (symbolp f) (cl--generic f)))
(defun cl-generic-ensure-function (name &optional noerror)
(let (generic
(origname name))
@ -1023,6 +1027,20 @@ The value returned is a list of elements of the form
(push (cl--generic-method-info method) docs))))
docs))
(defun cl--generic-method-files (method)
"Return a list of files where METHOD is defined by `cl-defmethod'.
The list will have entries of the form (FILE . (METHOD ...))
where (METHOD ...) contains the qualifiers and specializers of
the method and is a suitable argument for
`find-function-search-for-symbol'. Filenames are absolute."
(let (result)
(pcase-dolist (`(,file . ,defs) load-history)
(dolist (def defs)
(when (and (eq (car-safe def) 'cl-defmethod)
(eq (cadr def) method))
(push (cons file (cdr def)) result))))
result))
;;; Support for (head <val>) specializers.
;; For both the `eql' and the `head' specializers, the dispatch