Last active
November 30, 2023 13:05
-
-
Save svanellewee/30590d8acdfed808af916d05008bb505 to your computer and use it in GitHub Desktop.
Emacs Lisp Gist: DEFER-ing/ Python's try finally
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun some-dodgey-function (value) | |
(let* ((result (/ 10 value))) | |
(message "Rwesult is %d" result))) | |
(defun some-recovery-or-cleanup-code-to-always-run () | |
(message "I ALWAwYS RUN!!!")) | |
(unwind-protect | |
(some-dodgey-function 0) | |
(some-recovery-or-cleanup-code-to-always-run)) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let*: Arithmetic error | |
next-line: End of buffer [2 times] | |
I ALWAwYS RUN!!! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I suppose it's more like python's
try: finally
. ;-)