[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: |
Mon, 26 Apr 2021 21:57:46 +0000 |
This patch adds the condition-case handler syntax
(:success BODY)
for code executed when the protected form terminates without error. BODY
is then executed with the variable bound to the result of the protected
form, and the result of BODY is then the value of the condition-case
form as usual.
This plugs an annoying hole in elisp: there hasn't been any direct
access to the success continuation
Would a macro not be enough to cover that particular programming pattern?
E.g. something like:
(defmacro success-case (value action continuation &rest handlers)
`(catch 'success-case-fail
((lambda (,value) ,continuation)
(catch 'success-case-success
(throw 'success-case-fail
(condition-case ,value
(throw 'success-case-success ,action) ,@handlers))))))
With this macro you can write for example:
(success-case result
(read buffer)
(use result)
(end-of-file 'eof))
which is IMO even more concise and elegant.
- bug#47677: [PATCH] condition-case success continuation, (continued)
- bug#47677: [PATCH] condition-case success continuation, Filipp Gunbin, 2021/04/26
- bug#47677: [PATCH] condition-case success continuation, Mattias EngdegÄrd, 2021/04/27
- bug#47677: [PATCH] condition-case success continuation, Gregory Heytings, 2021/04/27
- bug#47677: [PATCH] condition-case success continuation, Filipp Gunbin, 2021/04/29
- bug#47677: [PATCH] condition-case success continuation, Lars Ingebrigtsen, 2021/04/25
- bug#47677: [PATCH] condition-case success continuation, Mattias EngdegÄrd, 2021/04/26
- bug#47677: [PATCH] condition-case success continuation, Richard Stallman, 2021/04/26
bug#47677: [PATCH] condition-case success continuation,
Gregory Heytings <=