[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: idle exit hook
From: |
Phillip Lord |
Subject: |
Re: idle exit hook |
Date: |
Thu, 23 Jul 2020 13:16:41 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (gnu/linux) |
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