unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Phillip Lord <phillip.lord@russet.org.uk>
To: Ergus <spacibba@aol.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: idle exit hook
Date: Thu, 23 Jul 2020 13:16:41 +0100	[thread overview]
Message-ID: <87zh7q1l5i.fsf@russet.org.uk> (raw)
In-Reply-To: <20200721180146.huna7amd6rhftfuz@ergus> (Ergus's message of "Tue,  21 Jul 2020 20:01:47 +0200")

Ergus <spacibba@aol.com> writes:

> Hi:
>
> I recently saw a question in reddit but the answer there was not
> clear (or maybe it requires a feature request)
>
> Is there an idle-time-exit-hook or, what's the canonical method to call
> a function after breaking an idle? something like on-idle-exit?
>
> So far I understand that having such a hook could produce some
> performance penalty but not more than post-command-hook for example. Any
> way, adding some restrictions (running it only once || reset the
> hooks list on every idle start/end or just documenting it properly)
> could solve the problem.. does it makes sense.


Not that I know of, but I think you achieve it easily.

If you put a function on the idle-timer hook, then it will start to run
as soon as Emacs idles. If this function calls `sit-for' then it will
stall untill input arrives which is also when idle exits.

If you want a proper hook, you create a hook and have your idle function
call that hook.

Phil



      reply	other threads:[~2020-07-23 12:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200721180146.huna7amd6rhftfuz.ref@ergus>
2020-07-21 18:01 ` idle exit hook Ergus
2020-07-23 12:16   ` Phillip Lord [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=87zh7q1l5i.fsf@russet.org.uk \
    --to=phillip.lord@russet.org.uk \
    --cc=help-gnu-emacs@gnu.org \
    --cc=spacibba@aol.com \
    /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.
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).