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

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

bug#68075: 30.0.50; New special form `handler-bind`


From: Stefan Monnier
Subject: bug#68075: 30.0.50; New special form `handler-bind`
Date: Thu, 28 Dec 2023 17:04:45 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

>> I'm trying to explain that when looking for a handler, we look both for
>> condition-case handler and handler-bind handlers and we use whichever is
>> "closest", i.e. more deeply nested.  So just like a local
>> `condition-case` overrides temporarily an outer one, the same holds not
>> only among `handler-bind`s but also between `condition-case` and
>> `handler-bind` as well.
>
> Then, it would also make sense to make `condition-case' and
> `handler-bind' refer to each other from the docstrings.

BTW, `condition-case` can be implemented as a macro on top of
`handler-bind` and `catch`, e.g.

    (condition-case ERR FORM (error HANDLER))

can become something like:

    (let* ((tag (cons nil nil))
           (ERR (catch tag
                  (handler-bind ((error (lambda (err) (throw tag err))))
                    (cons 'noerror FORM)))))
      (if (eq 'noerror (car ERR))
          (cdr ERR)
        HANDLER))

:-)


-- Stefan






reply via email to

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