unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Markus Triska <triska@metalevel.at>
Cc: 23963@debbugs.gnu.org
Subject: bug#23963: 25.0.95; Feature request: setup-unwind-protect, complementing unwind-protect
Date: Sat, 27 Jan 2018 16:17:19 -0500	[thread overview]
Message-ID: <jwvlggjnh6u.fsf-monnier+bug#23963@gnu.org> (raw)
In-Reply-To: <m2d1mif3vm.fsf@metalevel.at> (Markus Triska's message of "Wed, 13 Jul 2016 08:28:45 +0200")

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	other threads:[~2018-01-27 21:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-13  6:28 bug#23963: 25.0.95; Feature request: setup-unwind-protect, complementing unwind-protect Markus Triska
2018-01-27 21:17 ` Stefan Monnier [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='jwvlggjnh6u.fsf-monnier+bug#23963@gnu.org' \
    --to=monnier@iro.umontreal.ca \
    --cc=23963@debbugs.gnu.org \
    --cc=triska@metalevel.at \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).