From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Cc: Gemini Lasswell <gazally@runbox.com>
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 [thread overview]
Message-ID: <jwv60bpx90r.fsf-monnier+emacsdiffs@gnu.org> (raw)
In-Reply-To: <20171008231451.3FBBC20326@vcs0.savannah.gnu.org> (Gemini Lasswell's message of "Sun, 8 Oct 2017 19:14:51 -0400 (EDT)")
> +@defopt 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)
next parent reply other threads:[~2017-10-09 4:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20171008231448.29638.520@vcs0.savannah.gnu.org>
[not found] ` <20171008231451.3FBBC20326@vcs0.savannah.gnu.org>
2017-10-09 4:13 ` Stefan Monnier [this message]
2017-10-11 15:44 ` [Emacs-diffs] master 06e452a 1/3: Allow Edebug's instrumentation to be used for other purposes Gemini Lasswell
2017-10-11 16:11 ` Stefan Monnier
2017-10-15 18:06 ` Gemini Lasswell
2017-10-16 1:30 ` Stefan Monnier
2017-10-11 20:02 ` Alan Mackenzie
2017-10-11 20:32 ` Stefan Monnier
2017-10-11 20:36 ` Alan Mackenzie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv60bpx90r.fsf-monnier+emacsdiffs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=gazally@runbox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.