From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 06e452a 1/3: Allow Edebug's instrumentation to be used for other purposes Date: Wed, 11 Oct 2017 12:11:10 -0400 Message-ID: References: <20171008231448.29638.520@vcs0.savannah.gnu.org> <20171008231451.3FBBC20326@vcs0.savannah.gnu.org> <87a80xadug.fsf@runbox.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1507738294 823 195.159.176.226 (11 Oct 2017 16:11:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 11 Oct 2017 16:11:34 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Gemini Lasswell Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 11 18:11:29 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2JbN-0007KJ-QE for ged-emacs-devel@m.gmane.org; Wed, 11 Oct 2017 18:11:21 +0200 Original-Received: from localhost ([::1]:41728 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2JbV-00005a-0o for ged-emacs-devel@m.gmane.org; Wed, 11 Oct 2017 12:11:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2JbN-00005T-Qy for emacs-devel@gnu.org; Wed, 11 Oct 2017 12:11:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e2JbG-0006E1-CI for emacs-devel@gnu.org; Wed, 11 Oct 2017 12:11:21 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:43927) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2JbG-0006Da-5x for emacs-devel@gnu.org; Wed, 11 Oct 2017 12:11:14 -0400 Original-Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v9BGBBFP004867; Wed, 11 Oct 2017 12:11:11 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id EB48A66259; Wed, 11 Oct 2017 12:11:10 -0400 (EDT) In-Reply-To: <87a80xadug.fsf@runbox.com> (Gemini Lasswell's message of "Wed, 11 Oct 2017 08:44:39 -0700") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6134=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6134> : inlines <6123> : streams <1766808> : uri <2514872> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:219379 Archived-At: >> This seems a bit awkward. >> How 'bout something like the 100% untested patch below? > OK with me. I'll test the patch and make the change. Do you think > edebug-after-instrumentation-functions should also be changed to > edebug-after-instrumentation-function? I guess we could use a patch like below, indeed, which would make it possible to change the instrumented code (i.e. it would be slightly more general). It's not as important, tho, because edebug-after-instrumentation-functions starts as nil, so it works OK, contrarily to edebug-new-definition-functions where we need to remove-hook its default value, which is really ugly. Stefan diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index a070ff25d1..3381543f0a 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -1067,8 +1067,8 @@ edebug-best-error ;; Hooks 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. +(defvar edebug-after-instrumentation-function #'identity + "FIXME 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.") @@ -1189,8 +1189,7 @@ edebug-read-and-maybe-wrap-form1 ;; 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?