[Top][All Lists]

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

Re: unwind-protect and inhibit-quit

From: Felix Dietrich
Subject: Re: unwind-protect and inhibit-quit
Date: Sat, 17 Jul 2021 13:52:40 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Stefan Monnier via Users list for the GNU Emacs text editor
<> writes:

>>>>  (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.
>> But at which point is the ‘quit-flag’ actually handled?
> Doesn't matter.  The problem can occur without any quit.  If an error is
> signaled after creation of the process but before `ftp-setup-buffer`
> terminates, the same problem will occur.

But, presumably, if an error occurs in ‘ftp-setup-buffer’ it is still
‘ftp-setup-buffer’ responsibility to handle the error, clean-up the
process, and, then, maybe, propagate/rethrow the signal, no?

    (defun ftp-setup-buffer ()
      (let (process)
        (condition-case err
              (setq process (start-process …))
              ;; do stuff that may throw an error
              process ; Could errors still happen here (besides quit)?
                      ; Can quit happen?
           (and (processp process)
                (kill-process process))
           (signal (car err) (cdr err))))))

Felix Dietrich

reply via email to

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