Change Edebug's behavior-changing hooks to variables

* lisp/emacs-lisp/edebug.el (edebug-after-instrumentation-functions)
(edebug-new-definition-functions): Deleted.
(edebug-after-instrumentation-function)
(edebug-new-definition-function): New variables.
(edebug-behavior-alist): Update docstring.
(edebug-read-and-maybe-wrap-form1, edebug-make-form-wrapper): Use new
variables.

* lisp/emacs-lisp/testcover.el (testcover-start)
(testcover-this-defun): Use `edebug-after-instrumentation-function' and
`edebug-new-definition-function'.
(testcover-after-instrumentation): Return passed form.
(testcover-init-definition): Use argument instead of `edebug-def-name'.

* doc/lispref/edebug.texi (Edebug Options): Replace descriptions of
`edebug-after-instrumentation-functions' and `edebug-new-definition-functions'
with `edebug-after-instrumentation-function' and
`edebug-new-definition-function'.
This commit is contained in:
Gemini Lasswell 2017-10-14 09:13:36 -07:00
parent 9c8f8de0f3
commit e07cf691de
4 changed files with 39 additions and 48 deletions

View file

@ -193,12 +193,9 @@ If BYTE-COMPILE is non-nil, byte compile each function after instrumenting."
testcover-module-constants nil
testcover-module-1value-functions nil
testcover-module-potentially-1value-functions nil)
(cl-letf ((edebug-all-defs t)
(edebug-after-instrumentation-functions)
(edebug-new-definition-functions))
(add-hook 'edebug-after-instrumentation-functions 'testcover-after-instrumentation)
(add-hook 'edebug-new-definition-functions 'testcover-init-definition)
(remove-hook 'edebug-new-definition-functions 'edebug-announce-definition)
(let ((edebug-all-defs t)
(edebug-after-instrumentation-function #'testcover-after-instrumentation)
(edebug-new-definition-function #'testcover-init-definition))
(eval-buffer buf)))
(when byte-compile
(dolist (x (reverse edebug-form-data))
@ -210,12 +207,9 @@ If BYTE-COMPILE is non-nil, byte compile each function after instrumenting."
(defun testcover-this-defun ()
"Start coverage on function under point."
(interactive)
(cl-letf ((edebug-all-defs t)
(edebug-after-instrumentation-functions)
(edebug-new-definition-functions))
(add-hook 'edebug-after-instrumentation-functions 'testcover-after-instrumentation)
(add-hook 'edebug-new-definition-functions 'testcover-init-definition)
(remove-hook 'edebug-new-definition-functions 'edebug-announce-definition)
(let ((edebug-all-defs t)
(edebug-after-instrumentation-function #'testcover-after-instrumentation)
(edebug-new-definition-function #'testcover-init-definition))
(eval-defun nil)))
(defun testcover-end (filename)
@ -231,11 +225,12 @@ If BYTE-COMPILE is non-nil, byte compile each function after instrumenting."
(defun testcover-after-instrumentation (form)
"Analyze FORM for code coverage."
(testcover-analyze-coverage form))
(testcover-analyze-coverage form)
form)
(defun testcover-init-definition (sym)
"Mark SYM as under test coverage."
(message "Testcover: %s" edebug-def-name)
(message "Testcover: %s" sym)
(put sym 'edebug-behavior 'testcover))
(defun testcover-enter (func _args body)