Function: edebug-instrument-function
edebug-instrument-function is a byte-compiled function defined in
edebug.el.gz.
Signature
(edebug-instrument-function FUNC)
Documentation
Instrument the function or generic method FUNC.
Return the list of function symbols which were instrumented. This may be simply (FUNC) for a normal function, or a list of generated symbols for methods. If a function or method to instrument cannot be found, signal an error.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/edebug.el.gz
(defun edebug-instrument-function (func)
"Instrument the function or generic method FUNC.
Return the list of function symbols which were instrumented.
This may be simply (FUNC) for a normal function, or a list of
generated symbols for methods. If a function or method to
instrument cannot be found, signal an error."
(let ((func-marker (get func 'edebug)))
(cond
((cl-generic-p func)
(let ((method-defs (cl--generic-method-files func))
symbols)
(unless method-defs
(error "Could not find any method definitions for %s" func))
(pcase-dolist (`(,file . ,spec) method-defs)
(let* ((loc (find-function-search-for-symbol spec 'cl-defmethod file)))
(unless (cdr loc)
(error "Could not find the definition for %s in its file" spec))
(with-current-buffer (car loc)
(goto-char (cdr loc))
(edebug-eval-top-level-form)
(push (edebug-form-data-symbol) symbols))))
symbols))
((and (markerp func-marker) (marker-buffer func-marker))
;; It is uninstrumented, so instrument it.
(with-current-buffer (marker-buffer func-marker)
(goto-char func-marker)
(edebug-eval-top-level-form)
(list func)))
((and (consp func-marker) (consp (symbol-function func)))
(message "%s is already instrumented." func)
(list func))
(t
(let ((loc (find-function-noselect func t)))
(unless (cdr loc)
(error "Could not find the definition in its file"))
(with-current-buffer (car loc)
(goto-char (cdr loc))
(edebug-eval-top-level-form)
(list func)))))))