From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#68075: 30.0.50; New special form `handler-bind` Date: Thu, 28 Dec 2023 17:04:45 -0500 Message-ID: References: <835y0i92kb.fsf@gnu.org> <87bkaa6v68.fsf@localhost> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28447"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , 68075@debbugs.gnu.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 28 23:06:31 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 1rIyWK-00076p-Pl for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 28 Dec 2023 23:06:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rIyW6-0001Le-5U; Thu, 28 Dec 2023 17:06:14 -0500 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 1rIyW4-0001LI-M4 for bug-gnu-emacs@gnu.org; Thu, 28 Dec 2023 17:06:12 -0500 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 1rIyVv-0004a3-4r for bug-gnu-emacs@gnu.org; Thu, 28 Dec 2023 17:06:12 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rIyVu-0004oD-Dl for bug-gnu-emacs@gnu.org; Thu, 28 Dec 2023 17:06:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 Dec 2023 22:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68075 X-GNU-PR-Package: emacs Original-Received: via spool by 68075-submit@debbugs.gnu.org id=B68075.170380110818421 (code B ref 68075); Thu, 28 Dec 2023 22:06:02 +0000 Original-Received: (at 68075) by debbugs.gnu.org; 28 Dec 2023 22:05:08 +0000 Original-Received: from localhost ([127.0.0.1]:40431 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rIyUy-0004mz-OO for submit@debbugs.gnu.org; Thu, 28 Dec 2023 17:05:07 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:41224) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rIyUu-0004mI-2j for 68075@debbugs.gnu.org; Thu, 28 Dec 2023 17:05:03 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 0EA3010009E; Thu, 28 Dec 2023 17:04:55 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1703801094; bh=ct7WVWB6Jdtpr4z28xEcshyNaXXyCZPYTYrMYtP5UTY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=kV9vVpNMVcQ+E91+7eaeHsYhvrd4ar3FsoqkqlUNqkoZZjtflHBmGQdZtwmIlbhpa YtFz160uEsYcm3H8LdAsRwlA0jWOlvKw/bP9Xquld42XNugqCxbH4jqB5Pm8uSF5P8 0Q4RcBYz01mPyxM0WCmryY3J/g44d+F+B+Grq+XWmoFSz4ktR1GeI1U817pH1YyxQq 1s3UuYgtMV+gMrrBavsJYmDn+DGTR/mlzmXSBVaT356wQdiv4UKfQYTVdHcT+SPQoC hY+0Btt7pjwfgdW6Y0sb/pJ9S7PQeO9A2bw5jyeK5wE34Bh7BX5wZOiT4T880nGIg/ BhXs4v9m5ldxA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 21961100033; Thu, 28 Dec 2023 17:04:54 -0500 (EST) Original-Received: from pastel (65-110-221-238.cpe.pppoe.ca [65.110.221.238]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id EB74D120D74; Thu, 28 Dec 2023 17:04:53 -0500 (EST) In-Reply-To: <87bkaa6v68.fsf@localhost> (Ihor Radchenko's message of "Thu, 28 Dec 2023 18:25:51 +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:276995 Archived-At: >> I'm trying to explain that when looking for a handler, we look both for >> condition-case handler and handler-bind handlers and we use whichever is >> "closest", i.e. more deeply nested. So just like a local >> `condition-case` overrides temporarily an outer one, the same holds not >> only among `handler-bind`s but also between `condition-case` and >> `handler-bind` as well. > > Then, it would also make sense to make `condition-case' and > `handler-bind' refer to each other from the docstrings. BTW, `condition-case` can be implemented as a macro on top of `handler-bind` and `catch`, e.g. (condition-case ERR FORM (error HANDLER)) can become something like: (let* ((tag (cons nil nil)) (ERR (catch tag (handler-bind ((error (lambda (err) (throw tag err)))) (cons 'noerror FORM))))) (if (eq 'noerror (car ERR)) (cdr ERR) HANDLER)) :-) -- Stefan