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

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

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


From: Stefan Monnier
Subject: bug#23963: 25.0.95; Feature request: setup-unwind-protect, complementing unwind-protect
Date: Sat, 27 Jan 2018 16:17:19 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Markus Triska <triska@metalevel.at> 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





reply via email to

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