[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] master 06e452a 1/3: Allow Edebug's instrumentation to
From: |
Stefan Monnier |
Subject: |
Re: [Emacs-diffs] master 06e452a 1/3: Allow Edebug's instrumentation to be used for other purposes |
Date: |
Mon, 09 Oct 2017 00:13:24 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
> address@hidden edebug-after-instrumentation-functions
> +An abnormal hook run by Edebug after it instruments a form.
> +Each function is called with one argument, a form which has
> +just been instrumented by Edebug.
This seems a bit awkward.
How 'bout something like the 100% untested patch below?
Stefan
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index a070ff25d1..cfdd699bd9 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -1072,9 +1072,9 @@ edebug-after-instrumentation-functions
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-new-definition-function #'edebug-announce-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.")
@@ -1383,13 +1383,13 @@ edebug-make-form-wrapper
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."
+ (put def-name 'edebug-behavior 'edebug)
(message "Edebug: %s" def-name))
diff --git a/lisp/emacs-lisp/testcover.el b/lisp/emacs-lisp/testcover.el
index 3628968974..be07bc82cb 100644
--- a/lisp/emacs-lisp/testcover.el
+++ b/lisp/emacs-lisp/testcover.el
@@ -195,10 +195,10 @@ testcover-start
testcover-module-potentially-1value-functions nil)
(cl-letf ((edebug-all-defs t)
(edebug-after-instrumentation-functions)
- (edebug-new-definition-functions))
+ (edebug-new-definition-function))
(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)
+ (add-function :override edebug-new-definition-function
+ #'testcover-init-definition)
(eval-buffer buf)))
(when byte-compile
(dolist (x (reverse edebug-form-data))
@@ -212,10 +212,10 @@ testcover-this-defun
(interactive)
(cl-letf ((edebug-all-defs t)
(edebug-after-instrumentation-functions)
- (edebug-new-definition-functions))
+ (edebug-new-definition-function))
(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)
+ (add-function :override edebug-new-definition-function
+ #'testcover-init-definition)
(eval-defun nil)))
(defun testcover-end (filename)
- Re: [Emacs-diffs] master 06e452a 1/3: Allow Edebug's instrumentation to be used for other purposes,
Stefan Monnier <=