From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Newsgroups: gmane.emacs.bugs Subject: bug#65620: void function edebug-after Date: Thu, 31 Aug 2023 16:41:21 +0200 Message-ID: References: <87ledsku08.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16923"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Michael Heerdegen , 65620@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 31 16:42:14 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 1qbis9-0004EU-Vo for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 31 Aug 2023 16:42:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbirt-0007ME-6d; Thu, 31 Aug 2023 10:41:57 -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 1qbirs-0007HO-I4 for bug-gnu-emacs@gnu.org; Thu, 31 Aug 2023 10:41:56 -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 1qbirp-00080D-T8 for bug-gnu-emacs@gnu.org; Thu, 31 Aug 2023 10:41:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qbirx-000864-QU for bug-gnu-emacs@gnu.org; Thu, 31 Aug 2023 10:42:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 31 Aug 2023 14:42: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.169349290031096 (code B ref 65620); Thu, 31 Aug 2023 14:42:01 +0000 Original-Received: (at 65620) by debbugs.gnu.org; 31 Aug 2023 14:41:40 +0000 Original-Received: from localhost ([127.0.0.1]:56734 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qbirc-00085T-5K for submit@debbugs.gnu.org; Thu, 31 Aug 2023 10:41:40 -0400 Original-Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]:62683) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qbira-00085D-5m for 65620@debbugs.gnu.org; Thu, 31 Aug 2023 10:41:39 -0400 Original-Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-51a52a7d859so4451507a12.0 for <65620@debbugs.gnu.org>; Thu, 31 Aug 2023 07:41:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693492884; x=1694097684; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0FslL1fwBIzd2a6T5M2RSknMwkw15CZbS0+RCC6+UUA=; b=g9z7xWcGw7At8iLNsmBEfJcDSKI26FKYGbSFcoPIj0hdy7WAI/ba+LFQRTK5nMu+1c UVZONYAcHk7XOwWINj0dqOtP4Id2rbrC6m+Gs1IYuhQBFWQtg+LPrpb6PSjty9JNrey4 ymAGuz3B1vtN2au8dzqQGg11R+UZI7rsgqgNu9wSdzHIpq61eFRqlSFLbYuMYNA+8Ecm /vVDPDodmZ2PyT5R21dsIpr+rcfLGyN4TAeHpFmyIy3h7zaRqEA4TzD8+Fp8cIAyuoZt kkPnNHVJq6qwJATBHyqoIrRqCXo/GYfVu969fcobq2TvEyJaRuZpqc9U6iPt4GTAqBSG wywg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693492884; x=1694097684; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=0FslL1fwBIzd2a6T5M2RSknMwkw15CZbS0+RCC6+UUA=; b=ZSSrS+zKh12H0pXXDp9rrerD9eauPGZSZJHOlxDY9ypXPYvgBfKX0jtR/7uVJ12qUx 0WROVui0s+6jl24NFlneS99KLicNsszdRFx8rAkk0F1uphsSHnb05cc7QhLFGjIJ2N34 8Jz3twy7pOmdFakiyMaTs38li+szLmMXLT79oazUnY37rgV0GswKYmlzjcWVAlQZywfh tAzi1u1r7cm3aVjS8J/JV7BiAJZ+zYHSKX2jc9FkTTCEPPUR2A7dQmxgjUGPiynO0Dzz 835vDYVwOJzLJ61kOv5ks45/UgRrSPPS6UfJ1EmV5BM/gRBK5345apPpoWWYvVVhKjb4 XD+Q== X-Gm-Message-State: AOJu0YzppyQEc+5+soAYOYQOTHcqPo0WOIMp20el+/hehYq1QQKaCqMa WkcOvfSV/Bc73zcA+7vx7anOMisbHl8uYA== X-Google-Smtp-Source: AGHT+IF00jBYajJnxToKZspd6xwZvKHI7tQzCceesIR08sk444Fmp6xu+M/IaRMjPUZ++or6Sy0nCA== X-Received: by 2002:a17:906:30d2:b0:9a2:143e:a070 with SMTP id b18-20020a17090630d200b009a2143ea070mr2888248ejb.20.1693492883460; Thu, 31 Aug 2023 07:41:23 -0700 (PDT) Original-Received: from Mini.fritz.box (pd9e36a8f.dip0.t-ipconnect.de. [217.227.106.143]) by smtp.gmail.com with ESMTPSA id jj17-20020a170907985100b009888aa1da11sm827585ejc.188.2023.08.31.07.41.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Aug 2023 07:41:22 -0700 (PDT) In-Reply-To: (Alan Mackenzie's message of "Thu, 31 Aug 2023 13:50:11 +0000") 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:268823 Archived-At: Alan Mackenzie writes: > Hello, Gerd. Hallo Alan, Gr=C3=BC=C3=9Fe nach N=C3=BCrnberg :-). > > On Thu, Aug 31, 2023 at 09:55:18 +0200, Gerd M=C3=B6llmann 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 (whi= le >> > 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 conditi= on. > > 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. I think that's correct, but I wouldn't say Edebug evaluates CONDITION, but we probably mean the same thing: CONDITION is instrumented and HASH-IF then gets that as argument when FOO is macroexpanded. Then the execution of HASH-IF tries to evaluate the instrumented condition etc. >> 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. That would be one way. On the other hand, the instrumentation of CONDITION is actually kind of pointless, because nothing will be left of it in the fully macroexpanded FOO. So, one cannot step through CONDITION with Edebug anyway.