unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* idle exit hook
       [not found] <20200721180146.huna7amd6rhftfuz.ref@ergus>
@ 2020-07-21 18:01 ` Ergus
  2020-07-23 12:16   ` Phillip Lord
  0 siblings, 1 reply; 2+ messages in thread
From: Ergus @ 2020-07-21 18:01 UTC (permalink / raw)
  To: help-gnu-emacs

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?

Best,
Ergus



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: idle exit hook
  2020-07-21 18:01 ` idle exit hook Ergus
@ 2020-07-23 12:16   ` Phillip Lord
  0 siblings, 0 replies; 2+ messages in thread
From: Phillip Lord @ 2020-07-23 12:16 UTC (permalink / raw)
  To: Ergus; +Cc: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-23 12:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20200721180146.huna7amd6rhftfuz.ref@ergus>
2020-07-21 18:01 ` idle exit hook Ergus
2020-07-23 12:16   ` Phillip Lord

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