From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel =?UTF-8?Q?Mart=C3=ADn?= via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#50245: 28.0.50; Instrumenting a function does not show "Edebug:" in the echo area Date: Sat, 02 Oct 2021 15:06:01 +0200 Message-ID: References: <87r1ecdobe.fsf@gnus.org> Reply-To: Daniel =?UTF-8?Q?Mart=C3=ADn?= Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33721"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin) Cc: 50245@debbugs.gnu.org, Stefan Monnier To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 02 15:19:03 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mWeuq-0008WP-AO for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Oct 2021 15:19:01 +0200 Original-Received: from localhost ([::1]:53088 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWeun-0004Jh-Kl for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Oct 2021 09:18:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWejG-0003Uy-LF for bug-gnu-emacs@gnu.org; Sat, 02 Oct 2021 09:07:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46680) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWejG-00013e-E2 for bug-gnu-emacs@gnu.org; Sat, 02 Oct 2021 09:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mWejG-0001nG-5F for bug-gnu-emacs@gnu.org; Sat, 02 Oct 2021 09:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Oct 2021 13:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50245 X-GNU-PR-Package: emacs Original-Received: via spool by 50245-submit@debbugs.gnu.org id=B50245.16331799756837 (code B ref 50245); Sat, 02 Oct 2021 13:07:02 +0000 Original-Received: (at 50245) by debbugs.gnu.org; 2 Oct 2021 13:06:15 +0000 Original-Received: from localhost ([127.0.0.1]:58226 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mWeiU-0001mC-R9 for submit@debbugs.gnu.org; Sat, 02 Oct 2021 09:06:15 -0400 Original-Received: from sonic313-20.consmr.mail.ir2.yahoo.com ([77.238.179.187]:43331) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mWeiS-0001ly-Kb for 50245@debbugs.gnu.org; Sat, 02 Oct 2021 09:06:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1633179966; bh=AD84CGPaLCzaqv2cHS18jR75xfeen9uQh4sup/kJ0Jo=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=WbmTl7RcIT7XGLm0RiVkTqpfDSTFVdgUHzkqeuxP0XGhAKKXjmP2NNa4AEmUqKIaUquc65gvDt7PyWH2efubpi3OQ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dUrxNXnY48o2DTJb6SE1MQ1FMYZxc52mWOc3YEwa8MczfG4q2Dbx1cwTMGI vaQvuwu_hT5bkOF0mOU3mcroGjXHenB6SCn3sTSs5JMPwC7wzTDME.vH9zjsfIrcV96ohFg5W5Ld Toh5l5HQm43R1pocE1.GODoZimmSUwVU1QBXvWVW7hE_lLFirc8Q0lX2SPSVamhDG71mZz_Gui53 Lw9nbVylKDVi6VPVOOC.316S9s1lt1EnESPYwsHs2FegC5o0F1KEJVQugsoPW23Ih.52BDIhy1Zp aNC_QssgukkmMc9U6KgzOAkZwKbPpWToMUB2CLRowOY0pM2XJFKVUwVFRFOwCLMuy4NVtJDF_mLb XHf0OK4.AfkoHVe9s8ydkeYQBsQ1PxpzHD8.cczMoGXnQ_ZeX_0RQGWSLGLWifb6pV.kYElBnDLW 6aDszngkXUnFRbugTf962aJiD2MUf1PGWG1F58s_S_y6JLsEtTJplZqBHqgQy.vdHn_runG5hUu6 Y1LSzwJtIqt18NFcaJKDkcLG7g001_oDDYnd1N.1Qr X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ir2.yahoo.com with HTTP; Sat, 2 Oct 2021 13:06:06 +0000 Original-Received: by kubenode527.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID b34d2ed1792209361be4175313afed47; Sat, 02 Oct 2021 13:06:02 +0000 (UTC) In-Reply-To: <87r1ecdobe.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 29 Aug 2021 21:48:53 +0200") X-Mailer: WebService/1.1.19076 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:216144 Archived-At: Lars Ingebrigtsen writes: > > I'm having some problems following the logic in > `edebug--eval-defun'/`eval-defun' -- perhaps Stefan can help here; added > to the CCs. I decided to familiarize myself with the Edebug code so that I can fix bugs and implement features. An automatic git bisect says that this is the commit that make the regression evident: commit bae2cfe63cbd11eaf348dfa7fbb2b9f7362fc747 Author: Stefan Monnier Date: Thu Feb 18 10:27:36 2021 -0500 * lisp/emacs-lisp/edebug.el (eval-defun): Simplify (edebug-all-defs, edebug-all-forms): Don't autoload since the problem it was working around has been fixed a while back. (edebug--eval-defun): Rename from `edebug-eval-defun` and simplify by making it an `:around` advice. (edebug-install-read-eval-functions) (edebug-uninstall-read-eval-functions): Adjust accordingly. (edebug-eval-defun): Redefine as an obsolete wrapper. * lisp/progmodes/elisp-mode.el (elisp--eval-defun): Use `load-read-function` so it obeys `edebug-all-(defs|forms)`. (elisp--eval-defun): Fix recent regression introduced with `elisp--eval-defun-result`. If I'm not mistaken, the first "Edebug: defun" message is printed in elisp--eval-defun, inside the call to load-read-function. The second one is printed by the call to eval-region. This code path is newly exercised because edebug--eval-defun is now an :around advice after bae2cfe63cbd11eaf348dfa7fbb2b9f7362fc747. I'm not sure, but I think that the author's intent was to reduce code duplication (with possibly other benefits). My proposed patch first checks if edebugging is active and then avoids that eval-region prints by setting it's PRINTFLAG argument to nil: diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index acf7123225..d1a4200df2 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -1612,6 +1612,7 @@ elisp--eval-defun (let ((debug-on-error eval-expression-debug-on-error) (print-length eval-expression-print-length) (print-level eval-expression-print-level) + (edebugging edebug-all-defs) elisp--eval-defun-result) (save-excursion ;; Arrange for eval-region to "read" the (possibly) altered form. @@ -1629,8 +1630,9 @@ elisp--eval-defun ;; Alter the form if necessary. (let ((form (eval-sexp-add-defvars (elisp--eval-defun-1 - (macroexpand form))))) - (eval-region beg end standard-output + (macroexpand form)))) + (should-print (not edebugging))) + (eval-region beg end should-print (lambda (_ignore) ;; Skipping to the end of the specified region ;; will make eval-region return. This solves the problem and does not introduce any further regression. Any feedback on if this is TRT? If the patch looks good, I can accompany it with a comment that explains the reasoning, tests, etc. Thanks.