[Top][All Lists]

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

Re: unwind-protect and inhibit-quit

From: Stefan Monnier
Subject: Re: unwind-protect and inhibit-quit
Date: Fri, 16 Jul 2021 11:00:14 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Now I'm curious too... Would something like this work?
>  (let ((inhibit-quit t))
>    (setq process
>       (let ((inhibit-quit nil))
>          (ftp-setup-buffer host file))))

No.  The problem is not in the `setq` itself but in the fact that
a non-local exit from `ftp-setup-buffer` (e.g. because of `C-g`) will
cause `ftp-setup-buffer` not to return the process.

We should devise a more reliable API, tho I'm not completely sure what
it should look like.  Maybe

    (let ((list-of-created-processes nil))
      (unwind-protect ...
        (mapc #'delete-process list-of-created-processes)))

Where the low-level primitives which create processes add them to

But then this gets into trouble when some unrelated code is run during
`...` (e.g. via timers or whatnot) which creates unrelated processes, so
we'd need some extra care to make sure those processes don't get added
to "the same" `list-of-created-processes`.


reply via email to

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