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

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

Re: try-this-for ?


From: John Mastro
Subject: Re: try-this-for ?
Date: Wed, 17 Jan 2018 15:50:36 -0800

Emanuel Berg <moasen@zoho.com> wrote:
> Is there something like this:
>
>     (try-this-for SECONDS BODY)
>
> If BODY hasn't completed after SECONDS,
> everything will be aborted, i.e.
> the equivalence of `keyboard-quit' (or whatever
> appropriate).
>
> But what has already happened until the point
> of abortion don't have to be rolled back or any
> state restored or dumped or anything like that.
>
> If BODY do complete before SECONDS it should be
> transparent in the sense that what should be
> returned is the final evaluation of BODY.

There's `with-timeout' in timer.el, however (from the docstring):

    The timeout is checked whenever Emacs waits for some kind of
    external event (such as keyboard input, input from subprocesses, or
    a certain time); if the program loops without waiting in any way,
    the timeout will not be detected.

So it may not be exactly what you want.

        John



reply via email to

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