all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Felix Dietrich <felix.dietrich@sperrhaken.name>
To: help-gnu-emacs@gnu.org
Subject: Re: unwind-protect and inhibit-quit
Date: Fri, 16 Jul 2021 16:56:56 +0200	[thread overview]
Message-ID: <87o8b2parr.fsf@sperrhaken.name> (raw)
In-Reply-To: <87sg0epb98.fsf@sperrhaken.name> (Felix Dietrich's message of "Fri, 16 Jul 2021 16:46:27 +0200")

Felix Dietrich <felix.dietrich@sperrhaken.name> writes:

> 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.

Nevermind, the manual states (I added the ‘*’ as highlighting):
“Eventually, ‘inhibit-quit’ will become ‘nil’ again, such as when its
binding is unwound at the end of a ‘let’ form.  *At that time*, if
‘quit-flag’ is still non-‘nil’, *the requested quit happens
immediately.*”[1]  So there might be more happening at the end of a let.
I guess only the source will tell, and “there be dragons” is the
definitive warning to follow for now.

Footnotes:
[1]  (info "(elisp) Quitting")

-- 
Felix Dietrich



  reply	other threads:[~2021-07-16 14:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-15 15:14 unwind-protect and inhibit-quit Felix Dietrich
2021-07-16  7:18 ` Eli Zaretskii
2021-07-16  8:10   ` Thibaut Verron
2021-07-16 11:19     ` Eli Zaretskii
2021-07-16 14:46       ` Felix Dietrich
2021-07-16 14:56         ` Felix Dietrich [this message]
2021-07-16 15:00     ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-07-16 20:01       ` Thibaut Verron
2021-07-16 20:06         ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-07-16 21:30       ` Felix Dietrich
2021-07-16 21:37         ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-07-17 11:52           ` Felix Dietrich
2021-07-17  6:20         ` Eli Zaretskii
2021-07-17 15:46           ` Felix Dietrich
2021-07-17 16:34             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o8b2parr.fsf@sperrhaken.name \
    --to=felix.dietrich@sperrhaken.name \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.