From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: Attaching context info to an error Date: Sat, 23 Dec 2023 03:28:03 +0000 Message-ID: References: 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="1353"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 23 04:29:10 2023 Return-path: Envelope-to: ged-emacs-devel@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 1rGshK-0000E4-4j for ged-emacs-devel@m.gmane-mx.org; Sat, 23 Dec 2023 04:29:10 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGsgX-0006Uj-8q; Fri, 22 Dec 2023 22:28:21 -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 1rGsgW-0006Ua-CH for emacs-devel@gnu.org; Fri, 22 Dec 2023 22:28:20 -0500 Original-Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rGsgT-0005pI-O1 for emacs-devel@gnu.org; Fri, 22 Dec 2023 22:28:19 -0500 Original-Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40d4ebcc207so3102445e9.3 for ; Fri, 22 Dec 2023 19:28:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703302096; x=1703906896; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=CRo7UzHvnS40wkBJwK3W/MMyofcUDDRgAW3RUZFzZmk=; b=Xa9Z9NmaXM8qWLNeicYx9U6AG4E6fALV9BbEiKXPeA9/Zo7fQiCH4bhUMF9BKkUWF5 VVo0XKwQUKaCy3OHHEOyIcARLrcAR8rdJttsGUDqzPBz0Ox3agcSlC6f5DSb9KwH/W6r UrskVvqMq2njwtHR31p9hqC/zkH5zt9ey6xJkf2IgBpQNztVn+7kkMK68io4v3tajEVv Ldg6HCh1yHdozUa9alkFHIv7f9Lmj4vFE2LeRKjgntcbiNoVmuSsqW8Jfc1J4dnEnGhn kdmLS06Yp66V0sPX+CioABIf2dnL74SB7sKV2MyDfps96zBiu/7rwKDHWKSiTLV6hbNN 95Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703302096; x=1703906896; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CRo7UzHvnS40wkBJwK3W/MMyofcUDDRgAW3RUZFzZmk=; b=uhfD1PRwAM8ptSScD0Q2t7+Ws1p5VyCg3ozeJceKc/FJ9YKf3mgDVk47U665/tzd/l hEj1WjM5aLNJBxPM4tKMe2tVz+Q7qe9T/D1k8rJE4IJDfyrNBDK+R0KGOTSrBB84ssBl LK2R5IXhdrCXO0j2Aenr4OQ9K8hAvfjWVJ2AqXpYbnH8zSSFXkGvA8mXy7ow1XNV4Q5z U2Wnm4j1jn3Se+kUyApNoInM3Ac6Xun+a+nSnEANrf96f6ONQrQbVWDIQ7XOBkOQwDNv /WmqeX4TFAl9XZvIHxJ4dn/Pm8Q9Hx28YTMGaGDu3R7PKSAT29TKI131zE9fEf7E0/bf nz3Q== X-Gm-Message-State: AOJu0YxoOyO0mHTSXB/oV1jyo2Mi/OwxYyqd3Wiyl5tCzGYZ0RgtDLiD Z/wVflZrLe/4LnoOOB+wOD1pxTv7LxOhAN8aCZ6Jajdpik0= X-Google-Smtp-Source: AGHT+IE8Bu4szaUIn3lFErTqCiQTyONRKyboxj1DWgzOz5UWRCyEKLUzjsKMvDvwX6r24AZwW/xgsCLf1BpbfRRLmTI= X-Received: by 2002:a05:600c:4d01:b0:40c:2871:9729 with SMTP id u1-20020a05600c4d0100b0040c28719729mr1269398wmp.188.1703302095673; Fri, 22 Dec 2023 19:28:15 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=joaotavora@gmail.com; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:314093 Archived-At: On Sat, Dec 23, 2023 at 3:02=E2=80=AFAM Jo=C3=A3o T=C3=A1vora wrote: > (defun pm/invoke-restart (restart) > (interactive > (some-read-from-minibuffer-or-somesuch)) > (funcall (caadr restart))) > > (defun baz (sym) > (error "whoops, it happened again for %s" sym)) > > (defun bar () > (pm/with-retry-restart (:msg "Retry") (baz (gensym)))) > > (defun foo () > (bar)) > > (foo) > > ;; Local Variables: > ;; read-symbol-shorthands: (("pm/" . "poor-mans-restarts-")) > ;; End: > > This very code works fine in Common Lisp (just add a WHILE > macro to it) Just to be clear what I meant by this to those unfamiliar with Common Lisp and interactive restarts. It means I can invoke the restart interactively from the Common Lisp debugger that is invoked as the last step of the non-returning error. 'baz' will be called again and again with different arguments and always errors until I recompile it to something else that doesn't error, which I can do while the debugger is active. I expected to be able to do the same from the Emacs Lisp debugger-mode/backtrace-mode *Backtrace* buffer, but I never get one such buffer. Jo=C3=A3o