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

[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: Fri, 16 Jul 2021 16:46:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Thibaut Verron <thibaut.verron@gmail.com>
>> Date: Fri, 16 Jul 2021 10:10:36 +0200
>> Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
>> 
>> > You could use inhibit-quit, but that is generally a bad idea from the
>> > UI point of view, when invoking potentially long-running functions:
>> > you are preventing the user from interrupting that long function.  For
>> > example, suppose the FTP command stalls for some reason.
>> >
>> 
>> 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))))
>
> It might, but I still suggest to bind inhibit-quit non-nil only for
> short durations of time and as little as possible.  There be dragons.

I just found the “with-local-quit” macro.  Itʼs comment says that the
quit-flag “will not be handled until the next function call”.  Doesnʼt
that imply that once the let form has a value to return, the assignment
should go through?  Admittingly, this is a lot of guessing on my side,
as I do not know Emacs internals.

Also: isnʼt your advice “to bind inhibit-quit non-nil only for short
durations” heeded in Thibautʼs suggestions?  It is non-nil more or less
only for the assignment (and a bit for the setup of the let form).

-- 
Felix Dietrich



reply via email to

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