summaryrefslogtreecommitdiff
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorGemini Lasswell <gazally@runbox.com>2017-05-13 11:35:49 -0700
committerDmitry Gutov <dgutov@yandex.ru>2017-05-14 23:32:27 +0300
commite6f64df9c2b443d3385c2c25c29ccd5283d37e3f (patch)
tree487563d05e1133b4dc7147ed48b87c69e6fd4ff7 /lisp/subr.el
parent10037e4be2358597125a05db93f6fee551131d83 (diff)
downloademacs-e6f64df9c2b443d3385c2c25c29ccd5283d37e3f.tar.gz
Make edebug-step-in work on generic methods (Bug#22294)
* lisp/emacs-lisp/edebug.el (edebug-match-cl-generic-method-args): New function to implement the edebug-form-spec property of the symbol cl-generic-method-args. (edebug-instrument-function): If the function is a generic function, find and instrument all of its methods. Return a list instead of a single symbol. (edebug-instrument-callee): Now returns a list. Update docstring. (edebug-step-in): Handle the list returned by edebug-instrument-callee. * lisp/emacs-lisp/cl-generic.el (cl-defmethod): Use name and cl-generic-method-args in its Edebug spec. * lisp/emacs-lisp/eieio-compat.el (defmethod): Use name and cl-generic-method-args in its Edebug spec. * lisp/subr.el (method-files): New function. * test/lisp/subr-tests.el (subr-tests--method-files--finds-methods) (subr-tests--method-files--nonexistent-methods): New tests.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r--lisp/subr.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 02e79932233..8d5d2a779c6 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2026,6 +2026,25 @@ definition, variable definition, or face definition only."
(setq files (cdr files)))
file)))
+(defun 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 ((files load-history)
+ result)
+ (while files
+ (let ((defs (cdr (car files))))
+ (while defs
+ (let ((def (car defs)))
+ (if (and (eq (car-safe def) 'cl-defmethod)
+ (eq (cadr def) method))
+ (push (cons (car (car files)) (cdr def)) result)))
+ (setq defs (cdr defs))))
+ (setq files (cdr files)))
+ result))
+
(defun locate-library (library &optional nosuffix path interactive-call)
"Show the precise file name of Emacs library LIBRARY.
LIBRARY should be a relative file name of the library, a string.