diff options
Diffstat (limited to 'lisp/emacs-lisp/edebug.el')
-rw-r--r-- | lisp/emacs-lisp/edebug.el | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 77523de32c5..0e8f77e29a8 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -1065,16 +1065,17 @@ circular objects. Let `read' read everything else." (defvar edebug-error-point nil) (defvar edebug-best-error nil) -;; Hooks which may be used to extend Edebug's functionality. See +;; Functions which may be used to extend Edebug's functionality. See ;; Testcover for an example. -(defvar edebug-after-instrumentation-functions nil - "Abnormal hook run on code after instrumentation for debugging. -Each function is called with one argument, a form which has just -been instrumented for Edebugging.") - -(defvar edebug-new-definition-functions '(edebug-announce-definition) - "Abnormal hook run after Edebug wraps a new definition. -After Edebug has initialized its own data, each hook function is +(defvar edebug-after-instrumentation-function #'identity + "Function to run on code after instrumentation for debugging. +The function is called with one argument, a FORM which has just +been instrumented for Edebugging, and it should return either FORM +or a replacement form to use in its place.") + +(defvar edebug-new-definition-function #'edebug-new-definition + "Function to call after Edebug wraps a new definition. +After Edebug has initialized its own data, this function is called with one argument, the symbol associated with the definition, which may be the actual symbol defined or one generated by Edebug.") @@ -1087,9 +1088,9 @@ Each definition instrumented by Edebug will have a the instrumented code is running, Edebug will look here for the implementations of `edebug-enter', `edebug-before', and `edebug-after'. Edebug's instrumentation may be used for a new -purpose by adding an entry to this alist and a hook to -`edebug-new-definition-functions' which sets `edebug-behavior' -for the definition.") +purpose by adding an entry to this alist, and setting +`edebug-new-definition-function' to a function which sets +`edebug-behavior' for the definition.") (defun edebug-read-and-maybe-wrap-form () ;; Read a form and wrap it with edebug calls, if the conditions are right. @@ -1189,8 +1190,7 @@ for the definition.") ;; Not a defining form, and not edebugging. (t (edebug-read-sexp))))) - (run-hook-with-args 'edebug-after-instrumentation-functions result) - result))) + (funcall edebug-after-instrumentation-function result)))) (defvar edebug-def-args) ; args of defining form. (defvar edebug-def-interactive) ; is it an emacs interactive function? @@ -1383,13 +1383,14 @@ expressions; a `progn' form will be returned enclosing these forms." edebug-offset-list edebug-top-window-data )) - (put edebug-def-name 'edebug-behavior 'edebug) - (run-hook-with-args 'edebug-new-definition-functions edebug-def-name) + + (funcall edebug-new-definition-function edebug-def-name) result ))) -(defun edebug-announce-definition (def-name) - "Announce Edebug's processing of DEF-NAME." +(defun edebug-new-definition (def-name) + "Set up DEF-NAME to use Edebug's instrumentation functions." + (put def-name 'edebug-behavior 'edebug) (message "Edebug: %s" def-name)) |