Subject: Re: bug#23963: 25.0.95; Feature request: setup-unwind-protect, complementing unwind-protect

From: Stefan Monnier <[email-masked]>
Date: Sat, 27 Jan 2018 16:17:19 -0500

Markus Triska <[email-masked]> writes:

> With this primitive, we could write the example above as:
>
>     (setup-unwind-protect
>         (setq process (ftp-...))
>      (progn
>        ;; use process ...
>      (delete-process process))

Given my dislike of `setq` I'd rather use something else.

This said, we also have another problem: if the user hits C-g twice
in a row, the second may interrupt the `delete-process` itself.

So I think what we "really" want is more like

    (let ((oi inhibit-quit)
          (inhibit-quit t))
      (let ((process (ftp-...)))
         (unwind-protect
             (let ((inhibit-quit oi))
               ..use process..)
           (delete-process process))))

At the same time, any function whose name starts with "ftp-" is likely
a bad candidate for running it in a context where it can't be
interrupted (it's likely that in various circumstances it could hang, in
which case the user should be able to hit C-g).

        Stefan