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: Thu, 25 Aug 2022 00:32:09 +0200 Message-ID: References: <87r1ecdobe.fsf@gnus.org> <87o7wc2spo.fsf@gnus.org> Reply-To: Daniel =?UTF-8?Q?Mart=C3=ADn?= Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19286"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (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 Thu Aug 25 00:41:09 2022 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 1oQz3d-0004px-4F for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 25 Aug 2022 00:41:09 +0200 Original-Received: from localhost ([::1]:45264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQz3c-0005BF-35 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 24 Aug 2022 18:41:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49934) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQyvm-0007O0-95 for bug-gnu-emacs@gnu.org; Wed, 24 Aug 2022 18:33:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58656) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQyvl-0000KA-VS for bug-gnu-emacs@gnu.org; Wed, 24 Aug 2022 18:33:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oQyvl-0002zB-KQ for bug-gnu-emacs@gnu.org; Wed, 24 Aug 2022 18:33:01 -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: Wed, 24 Aug 2022 22:33:01 +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.166138034711435 (code B ref 50245); Wed, 24 Aug 2022 22:33:01 +0000 Original-Received: (at 50245) by debbugs.gnu.org; 24 Aug 2022 22:32:27 +0000 Original-Received: from localhost ([127.0.0.1]:48405 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQyvC-0002yM-N9 for submit@debbugs.gnu.org; Wed, 24 Aug 2022 18:32:27 -0400 Original-Received: from sonic311-31.consmr.mail.ir2.yahoo.com ([77.238.176.163]:32992) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQyv9-0002y5-Ct for 50245@debbugs.gnu.org; Wed, 24 Aug 2022 18:32:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1661380336; bh=KJRAHR5in19ScP34TWVFPxazc+xK0GmBBRWWLZo2hgc=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=MMPZDYH42d6dRrUs/IE5jQY35pk5bOotoyu+gZyk711FARHUNfTOAtNtPubXgbwN5KWCrLZ1Oywr3V2khw1nd65msf29engso9c+u682/bqKHtl6wVcc3a7VzAJsaw87wHXxtSTOFhQuORilTNvgfqQMQWwjNkeEzcIjCUbsiqt2vapEZMFh2rRHnNxtWH161Kjv2H0EyYPE8+MZrTTQZyyZ87HX+iEVe534gaOfQW/gwtbl6oGrpMfEPCdpIdIQOmTMDbhlebhyVyQOSnK6Tekw8Ilb6l63bKy1ZlrcV73UsUOJptIEa+k6ukKDpcaQKhaM2Mk3gxc2r1B6ZtGTUQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1661380336; bh=iekxuPrQvLXVKv3uOOAASGI6rAeFo5IfMbEMc5s5Cp0=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=Zyz0LgcA2hx2RAcal+mz6+MMkTgfxwf113xOhlH0WZl6apC8Ja3Q3QZZxw2ovWhuQOtcpXgpw3dPGBTywodbXnjuGeesjukjHLy587D4n81wa0YbT4q4hVx3ZN7NbS2/RogIMjbe+4Uss9vZUFPcZpz2QiEkBTL5T9ROXSKOpi10Ayz8pfQ8URc3+IAnMQoRwZlE1ebP8wFbGy69sLvuVRqNA4gChZecdIlU+aj7bO1dIh3U41OQ59XkcNge5PpSl3+VbhTJNiVGdk8CCDI1tN9z4JiCO4FNlzy7MZkqlX6BxCmXobYmfhHEdNRYDJklRkSYy9K0FNFcLVjH6IOugg== X-YMail-OSG: 1WyxHe0VM1lwBJFs2q75O8PpNkq6F0UpB.myf043KchJA_W8ncHOEt9yxOP3EjM JivN5cuENi8Gr3Yu7MMj_d28SLXJnpeFE4nJTqN72pXLeGB6aDArK2bkUmuCJWAVeZH21FBbCOET 4E6ZL3Fndoj.GsjmAxjQ2fNqn6L8VLdbQXXpeTMkmPwgqfFplkL06B8E8vvBsVANDI6hGF6CQvvS icotGVgJPte3Inqx56zgGboB.SjMmpw..j0lBv3..wsPrjOtcUTQRQSaxcK7ZX803dAnpw8gxMVl IwwQJvVbcHPVutJpEmchelHmtjAUp_oDUrmxOTo8xxq5gny42grKWaJ4x.Tibf9i19FxxWWyRF_2 vVLN1wPghfKsLphheZFxtT_Zyr7o.nQJDO.4OG9gH1XEiXsHgHaBTsh4Wc75GozitrzxqCrJQJVP ZvIIOorISdrxqvouzC6HRdSfoNP5jQCIdyOMF_7OjHo8Hf4pGckb47pkYjlJ157Kku1g34S5Bayc ZZdc9jVWRcBHrE9yPDkhFZnEozU.s5IrTLiI9R9uXWfonwycBGEpM_lIBWdujXscgwVkGHjbyMUP 3bXd7_.vZWQn_nHNoWQ9Zs2UxUgEE9mSfOnsCnoQc8iZilO258X9J3QPJu_eaxxsN4cx624eoeu. _DLhwr6vxuabKOQRF8qevxUoMQTeKiReHPmJy.xOiDBcMOFTpR4U.xT6zpI8zBHzNPz_7vB_40F2 euB4RRC73dV9IJRqIo.71Wmr7Vz0dfWeJR00gQGMS7R61evtYk8Nksb7IbNuXGaCUckD2wjUAjD1 PkpfmSpNJ2tJ7HYvEkvIc_P3cjMQnziQiQQAjFgONj X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.ir2.yahoo.com with HTTP; Wed, 24 Aug 2022 22:32:16 +0000 Original-Received: by hermes--canary-production-ir2-f74ffc99c-tc6tw (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 0d55123eed8ee62350dc2cd506f52bc0; Wed, 24 Aug 2022 22:32:11 +0000 (UTC) In-Reply-To: <87o7wc2spo.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 22 Aug 2022 17:39:15 +0200") X-Mailer: WebService/1.1.20560 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:240665 Archived-At: --=-=-= Content-Type: text/plain Lars Ingebrigtsen writes: > Stefan Monnier writes: > >>> If the patch looks good, I can accompany it with a comment that >>> explains the reasoning, tests, etc. >> >> Please do and thank you. > > This was almost a year ago -- Daniel, did you do any further work here? Here's a new version of the patch, which addresses Stefan's feedback. I've added a test because in the docstring of eval-defun we document that we print "Edebug: FUNCTION'" in the instrumented case, so I assume it's a behavior we'd like to keep working. Thanks. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-instrumented-eval-defun-not-printing-Edebug-to-t.patch >From 7649176669fbe49260ec2a0cee1865c3f4cf5f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= Date: Wed, 24 Aug 2022 23:34:18 +0200 Subject: [PATCH] Fix instrumented eval-defun not printing "Edebug:" to the echo area * lisp/progmodes/elisp-mode.el (elisp--eval-defun): Determine if we're instrumenting a function and call eval-region with PRINTFLAG set to nil if so. (Bug#50245) * test/lisp/progmodes/elisp-mode-tests.el (eval-defun-prints-edebug-when-instrumented): Add a new test. --- lisp/progmodes/elisp-mode.el | 8 ++++++-- test/lisp/progmodes/elisp-mode-tests.el | 10 ++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 0c4a9bfdbe..bc8833a693 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -1643,7 +1643,10 @@ elisp--eval-defun ;; FIXME: the print-length/level bindings should only be applied while ;; printing, not while evaluating. (defvar elisp--eval-defun-result) + ;; FIXME: This Edebug dependency is undesirable. See bug#50245 + (defvar edebug-all-defs) (let ((debug-on-error eval-expression-debug-on-error) + (edebugging edebug-all-defs) elisp--eval-defun-result) (save-excursion ;; Arrange for eval-region to "read" the (possibly) altered form. @@ -1668,8 +1671,9 @@ elisp--eval-defun (elisp--eval-defun-1 (macroexpand form))))) (print-length eval-expression-print-length) - (print-level eval-expression-print-level)) - (eval-region beg end standard-output + (print-level eval-expression-print-level) + (should-print (if (not edebugging) standard-output))) + (eval-region beg end should-print (lambda (_ignore) ;; Skipping to the end of the specified region ;; will make eval-region return. diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index 8e4dfa8bb8..345e8880c8 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -183,6 +183,16 @@ eval-last-sexp-print-format-large-int-echo (call-interactively #'eval-last-sexp) (should (equal (current-message) "66 (#o102, #x42, ?B)")))))) +;;; eval-defun + +(ert-deftest eval-defun-prints-edebug-when-instrumented () + (skip-unless (not noninteractive)) + (with-temp-buffer + (let ((current-prefix-arg '(4))) + (erase-buffer) (insert "(defun foo ())") (message nil) + (call-interactively #'eval-defun) + (should (equal (current-message) "Edebug: foo"))))) + ;;; eldoc (defun elisp-mode-tests--face-propertized-string (string) -- 2.34.1 --=-=-=--