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: Gregory Heytings
Subject: bug#47677: [PATCH] condition-case success continuation
Date: Tue, 27 Apr 2021 19:00:53 +0000



Unrelated to your comment: since several people have misunderstood the proposal, I'm closing the bug


I guess you did not see my previous post in this bug thread.

This bug should not be closed. I agree with Richard and Eli, it is not necessary to add that feature to Elisp, the more so as it can be implemented with a short macro:

(defmacro if-success (var action continuation &rest handlers)
  "Regain control when an error is signaled, otherwise continue.
Execute ACTION and, if no error happened, CONTINUATION, with VAR
bound to the return value of ACTION.
Otherwise, execute the appropriate HANDLER, with VAR bound to
(ERROR-SYMBOL . SIGNAL-DATA)."
  `(catch 'success-case-failure
     ((lambda (,var) ,continuation)
      (catch 'success-case-success
        (throw 'success-case-failure
               (condition-case ,var
                   (throw 'success-case-success ,action) ,@handlers))))))





reply via email to

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