bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#47677: [PATCH] condition-case success continuation


From: Mattias Engdegård
Subject: bug#47677: [PATCH] condition-case success continuation
Date: Mon, 12 Apr 2021 21:20:24 +0200

Here is an updated patch that reduces some code duplication in the compiler and 
fixes an embarrassing bug, and as a bonus, an experimental add-on that allows 
catching throws in condition-case using the handler syntax

  ((:catch TAG) BODY...)

Unfortunately but unsurprisingly the decision to evaluate the TAG expressions 
made everything much messier than anticipated. It does work, though, and if you 
would like to redefine `catch` as the macro

(defmacro catch (tag &rest body)
  (let ((var (gensym)))
    `(condition-case ,var (progn ,@body) ((:catch ,tag) ,var))))

then that will work, too (with minor byte-code inefficiency that could easily 
be addressed).
Any combination of error, :catch and :success handlers is permitted, making 
this a very versatile construct.

It may be a good idea to do away with the TAG evaluation since that flexibility 
isn't likely to be in high demand.

Attachment: 0001-Add-condition-case-success-handler-bug-47677.patch
Description: Binary data

Attachment: catch-in-condition-case.diff
Description: Binary data



reply via email to

[Prev in Thread] Current Thread [Next in Thread]