From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#65620: void function edebug-after Date: Thu, 31 Aug 2023 13:50:11 +0000 Message-ID: References: <87ledsku08.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14205"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Michael Heerdegen , acm@muc.de, 65620@debbugs.gnu.org To: Gerd =?UTF-8?Q?M=C3=B6llmann?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 31 15:51:02 2023 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 1qbi4c-0003SQ-4n for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 31 Aug 2023 15:51:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbi4W-0001LV-8J; Thu, 31 Aug 2023 09:50:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbi4U-0001It-BY for bug-gnu-emacs@gnu.org; Thu, 31 Aug 2023 09:50:54 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qbi4T-0005Ig-Sx for bug-gnu-emacs@gnu.org; Thu, 31 Aug 2023 09:50:54 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qbi4b-0006VW-QA for bug-gnu-emacs@gnu.org; Thu, 31 Aug 2023 09:51:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 31 Aug 2023 13:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65620 X-GNU-PR-Package: emacs Original-Received: via spool by 65620-submit@debbugs.gnu.org id=B65620.169348983024977 (code B ref 65620); Thu, 31 Aug 2023 13:51:01 +0000 Original-Received: (at 65620) by debbugs.gnu.org; 31 Aug 2023 13:50:30 +0000 Original-Received: from localhost ([127.0.0.1]:55205 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qbi45-0006Um-Nd for submit@debbugs.gnu.org; Thu, 31 Aug 2023 09:50:30 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:54170) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qbi43-0006UX-S9 for 65620@debbugs.gnu.org; Thu, 31 Aug 2023 09:50:29 -0400 Original-Received: (qmail 60618 invoked by uid 3782); 31 Aug 2023 15:50:13 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=muc.de; i=@muc.de; q=dns/txt; s=default; t=1693489813; h=date : to : cc : subject : message-id : references : mime-version : content-type : content-transfer-encoding : in-reply-to : from : from; bh=Fig1Ut55SScJdfC0aSae0mVw81enCzO/ZP3JVXQXtKg=; b=RS9Aws2SAL0CGKkpN4wAsC3KVSo/yBSMdwCDz1N3ysZx6hgF2aDy9yeY3mcyTjeniijkb 3e3CWmHzm9Nxsgg3/xWrSMKnumiC7+NWaNrA65ITPxpCDgAgkTAmuVLnOiBJ0I+XhwEydXH /M5BMTBduc/Yjg6LpyTAB4LDFgj+gbbD7FAmZIOe3VB+mAxfoXU9oIYlGYGZa5x84idrxtd 0alJpvpm1Mjors4FemXg6bvcoZtqpiXEQFcg0D58sc/H5t0bs7DvTNRNzjE40ZBY45IONGr 2eCUMzTo5EhqbRuIINzFiaM1VyFOAdYGL3cgjDGFgXje80lbTjD17yugGynQ== Original-Received: from acm.muc.de (p4fe15975.dip0.t-ipconnect.de [79.225.89.117]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 31 Aug 2023 15:50:11 +0200 Original-Received: (qmail 21562 invoked by uid 1000); 31 Aug 2023 13:50:11 -0000 Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:268822 Archived-At: Hello, Gerd. On Thu, Aug 31, 2023 at 09:55:18 +0200, Gerd Möllmann wrote: > Michael Heerdegen writes: > > Alan Mackenzie writes: > >> (defmacro hash-if (condition then-form &rest else-forms) > >> "A conditional compilation macro analogous to C's #if. > >> Evaluate CONDITION at macro-expansion time. If it is non-nil, > >> expand the macro to THEN-FORM. Otherwise expand it to ELSE-FORMS > >> enclosed in a `progn' form. ELSE-FORMS may be empty." > >> (declare (indent 2) > >> (debug (form sexp &rest sexp))) > >> (if (eval condition lexical-binding) > >> then-form > >> (cons 'progn else-forms))) > > Dunno if someone is able to fix this (I'm not). Until then using > > `def-form` `or `sexp` instead of `form` works in a better way (the > > former edebugs CONDITION when instrumenting, the latter would omit > > edebugging the CONDITION entirely). > > Anyway, the key point in the above example is that macroexpanding (while > > instrumenting) combined with the `eval' call seems to lead to the > > evaluation of instrumented code outside of an Edebug session when > > CONDITION is instrumented using `form`. `eval-when-compile' uses > > `def-form` for example - I guess using `form` in this case doesn't work > > as one might expect. > I think what's happening here is like this: > By using 'form' for condition, we're telling edebug to instruments it. > That is, the argument eval sees when foo is instrumented is whatever > edebug wraps around the condition (< ...), and that contains the > eval-after. Using sexp for the condition doesn't instrument the condition. Or, put a different way, edebug has instrumented CONDITION, then tries to evaluate this. This fails because there is no call to edebug-make-enter-wrapper around the thing, which would defalias edebug-after and edebug-before, and set up several lists that edebug needs. > One can follow that in the backtrace. > So, I guess there's nothing to fix here. I don't think I agree. eval (and probably apply and funcall and its variants) should somehow generate an "optional" edebug-make-enter-wrapper around them. This is currently not done. -- Alan Mackenzie (Nuremberg, Germany).