From unknown Fri Aug 15 02:02:43 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#39385 <39385@debbugs.gnu.org> To: bug#39385 <39385@debbugs.gnu.org> Subject: Status: Erroneous interaction of eval-when-compile and condition-case Reply-To: bug#39385 <39385@debbugs.gnu.org> Date: Fri, 15 Aug 2025 09:02:43 +0000 retitle 39385 Erroneous interaction of eval-when-compile and condition-case reassign 39385 emacs submitter 39385 Alan Mackenzie severity 39385 normal tag 39385 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 01 16:47:39 2020 Received: (at submit) by debbugs.gnu.org; 1 Feb 2020 21:47:39 +0000 Received: from localhost ([127.0.0.1]:39400 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iy0c7-0001I2-GY for submit@debbugs.gnu.org; Sat, 01 Feb 2020 16:47:39 -0500 Received: from lists.gnu.org ([209.51.188.17]:48542) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iy0c6-0001Hv-4q for submit@debbugs.gnu.org; Sat, 01 Feb 2020 16:47:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60570) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iy0c4-00068X-RY for bug-gnu-emacs@gnu.org; Sat, 01 Feb 2020 16:47:37 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iy0c3-0004uh-R0 for bug-gnu-emacs@gnu.org; Sat, 01 Feb 2020 16:47:36 -0500 Received: from colin.muc.de ([193.149.48.1]:30190 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1iy0c3-0004r5-Gm for bug-gnu-emacs@gnu.org; Sat, 01 Feb 2020 16:47:35 -0500 Received: (qmail 19242 invoked by uid 3782); 1 Feb 2020 21:47:32 -0000 Received: from acm.muc.de (p2E5D554B.dip0.t-ipconnect.de [46.93.85.75]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 01 Feb 2020 22:47:31 +0100 Received: (qmail 11285 invoked by uid 1000); 1 Feb 2020 21:47:31 -0000 Date: Sat, 1 Feb 2020 21:47:31 +0000 To: bug-gnu-emacs@gnu.org Subject: Erroneous interaction of eval-when-compile and condition-case Message-ID: <20200201214731.GA11168@ACM> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.1 X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Emacs. On master, with emacs -Q. Create the following file, bad-eval-when-compile.el: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defmacro c-safe (&rest body) ;; safely execute BODY, return nil if an error occurred `(condition-case nil (progn ,@body) (error nil))) (defmacro foo () (error "This message should not be seen")) (eval-when-compile (c-safe (foo))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Now do M-x byte-compile-file bad-eval-when-compile.el . This erroneously throws the error: This message should not be seen . This should have been caught by the condition-case generated by (c-safe ...). As a matter of interest, if eval-when-compile is replaced by cc-eval-when-compile: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defmacro cc-eval-when-compile (&rest body) `(eval-when-compile (eval '(progn ,@body)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; , then the compilation succeeds. So it would appear that there is a bug in the byte compiler's handling of eval-when-compile. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 01 20:04:21 2020 Received: (at 39385) by debbugs.gnu.org; 2 Feb 2020 01:04:21 +0000 Received: from localhost ([127.0.0.1]:39453 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iy3gT-000637-Jd for submit@debbugs.gnu.org; Sat, 01 Feb 2020 20:04:21 -0500 Received: from mail-qk1-f170.google.com ([209.85.222.170]:38462) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iy3gR-00062u-4l for 39385@debbugs.gnu.org; Sat, 01 Feb 2020 20:04:19 -0500 Received: by mail-qk1-f170.google.com with SMTP id k6so10674843qki.5 for <39385@debbugs.gnu.org>; Sat, 01 Feb 2020 17:04:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=rqqx7Pjjnb8w9MS5rMrQh02jiQ9VJ50hD/V/TRIGIc8=; b=NTtZGltJsmY3uAXHfsiCXvCtLVsyJsc/VyOqCpQy/WQFGU9XyVDt8GJmCh+hljs2qC qAsb/urzZkk42mUPZ2UB/BHx0l0qYVaTxyjhlyfdN9feS6e5AFZagLW4tW7HG944hJzU Hckt1p/k5Ai0WqkfwlDJ6BOZPEBoP7kWCYaBZszQvQy9/MF0PwAUUIw6hHCkpIYA9Cu8 vriHXYp7vgTkca6KnNdKbXXJLYDOy2PV0FdfRpXnvFgV52VOeqtHo81bdIC7SauvwsRY +pORPHSWgRjkOjfO2/TqxmLix1ISvVNsDIKIeSToiInzGuXs4tR6XCLAmXxrgoU+V4li KRMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=rqqx7Pjjnb8w9MS5rMrQh02jiQ9VJ50hD/V/TRIGIc8=; b=bvf2KpfKhE3qi18YT+9QmsAOONN7oYFSK7qQvyxtb4FV38DtBlv0zVpFjRvo/dAdPl rmH1f/tojZOSB7uPA8Og0r7MyeAjjIW0MLknSVhwnEEzW9HnE5wq5RrU304jIO+ERYgk R0rR151m6QWtl4e3dx4e9Oo9rxwbVspB6NVQubkP6sfnHz8p4/FWzJ4JBSLqRniP4+JA e65y7E5sKJj8YvkXN4jd6iHx2Tx1oyZ2ZsLnDp7Ea3rM3M//SJDPWcP61q33lxDwrMwr GSaARGU3Amg6KUA7K2JHop3bGMKJOBv2SjkP4EWfeq9kkyvrgxDV/l9VWkwzmrV4UU3z /FRg== X-Gm-Message-State: APjAAAVhP2MAos6i9LJRemsazabXR/xnMrYIkMi4nz9xY6DTqWlXj8fF prGpRqGcfgEQdiNj+Tj3HiShld6S X-Google-Smtp-Source: APXvYqxpYFSc4Ih4PFh2Gs2IvTxQ5ZXIifLifGjd30o2aPVc6EhCCXWHD6xBJw6vdxKVU3JP/AbWfg== X-Received: by 2002:ae9:c205:: with SMTP id j5mr16963875qkg.58.1580605453331; Sat, 01 Feb 2020 17:04:13 -0800 (PST) Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.gmail.com with ESMTPSA id s48sm7652520qtc.96.2020.02.01.17.04.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 01 Feb 2020 17:04:12 -0800 (PST) From: Noam Postavsky To: Alan Mackenzie Subject: Re: bug#39385: Erroneous interaction of eval-when-compile and condition-case References: <20200201214731.GA11168@ACM> Date: Sat, 01 Feb 2020 20:04:11 -0500 In-Reply-To: <20200201214731.GA11168@ACM> (Alan Mackenzie's message of "Sat, 1 Feb 2020 21:47:31 +0000") Message-ID: <87o8uhby0k.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39385 Cc: 39385@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Alan Mackenzie writes: > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > (defmacro c-safe (&rest body) > ;; safely execute BODY, return nil if an error occurred > `(condition-case nil > (progn ,@body) > (error nil))) > > (defmacro foo () > (error "This message should not be seen")) > > (eval-when-compile > (c-safe (foo))) > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > Now do M-x byte-compile-file bad-eval-when-compile.el . This > erroneously throws the error: > > This message should not be seen The same happens without eval-when-compile. > . This should have been caught by the condition-case generated by > (c-safe ...). I don't think so, because the condition-case is in the code generated by c-safe (because the condition-case is quoted), whereas the error is signaled while generating the code (because the error call is not quoted). From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 02 08:20:31 2020 Received: (at 39385) by debbugs.gnu.org; 2 Feb 2020 13:20:31 +0000 Received: from localhost ([127.0.0.1]:39594 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iyFAt-0000xl-55 for submit@debbugs.gnu.org; Sun, 02 Feb 2020 08:20:31 -0500 Received: from colin.muc.de ([193.149.48.1]:25254 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1iyFAq-0000xb-Mc for 39385@debbugs.gnu.org; Sun, 02 Feb 2020 08:20:29 -0500 Received: (qmail 72933 invoked by uid 3782); 2 Feb 2020 13:20:26 -0000 Received: from acm.muc.de (p2E5D58E7.dip0.t-ipconnect.de [46.93.88.231]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 02 Feb 2020 14:20:24 +0100 Received: (qmail 6425 invoked by uid 1000); 2 Feb 2020 13:20:24 -0000 Date: Sun, 2 Feb 2020 13:20:24 +0000 To: Noam Postavsky Subject: Re: bug#39385: Erroneous interaction of eval-when-compile and condition-case Message-ID: <20200202132024.GB5547@ACM> References: <20200201214731.GA11168@ACM> <87o8uhby0k.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87o8uhby0k.fsf@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39385 Cc: 39385@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Noam. On Sat, Feb 01, 2020 at 20:04:11 -0500, Noam Postavsky wrote: > Alan Mackenzie writes: > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > (defmacro c-safe (&rest body) > > ;; safely execute BODY, return nil if an error occurred > > `(condition-case nil > > (progn ,@body) > > (error nil))) > > (defmacro foo () > > (error "This message should not be seen")) > > (eval-when-compile > > (c-safe (foo))) > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > Now do M-x byte-compile-file bad-eval-when-compile.el . This > > erroneously throws the error: > > This message should not be seen > The same happens without eval-when-compile. > > . This should have been caught by the condition-case generated by > > (c-safe ...). > I don't think so, because the condition-case is in the code generated by > c-safe (because the condition-case is quoted), whereas the error is > signaled while generating the code (because the error call is not > quoted). Ah, I think I've got it. The macro is being expanded before the condition-case is active, and this is when it throws the error. Thanks for the help. I'll close this as notabug. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 02 10:37:44 2020 Received: (at 39385) by debbugs.gnu.org; 2 Feb 2020 15:37:44 +0000 Received: from localhost ([127.0.0.1]:40407 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iyHJg-0004u4-9N for submit@debbugs.gnu.org; Sun, 02 Feb 2020 10:37:44 -0500 Received: from colin.muc.de ([193.149.48.1]:61194 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1iyHJe-0004to-27 for 39385@debbugs.gnu.org; Sun, 02 Feb 2020 10:37:42 -0500 Received: (qmail 9747 invoked by uid 3782); 2 Feb 2020 15:37:40 -0000 Received: from acm.muc.de (p2E5D58E7.dip0.t-ipconnect.de [46.93.88.231]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 02 Feb 2020 16:37:39 +0100 Received: (qmail 6841 invoked by uid 1000); 2 Feb 2020 15:37:39 -0000 Date: Sun, 2 Feb 2020 15:37:39 +0000 To: control@debbugs.gnu.org Subject: Re: bug#39385: Erroneous interaction of eval-when-compile and condition-case Message-ID: <20200202153739.GC5547@ACM> References: <20200201214731.GA11168@ACM> <87o8uhby0k.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87o8uhby0k.fsf@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39385 Cc: 39385@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 39385 notabug close 39385 quit -- Alan Mackenzie (Nuremberg, Germany). From unknown Fri Aug 15 02:02:43 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 02 Mar 2020 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator