Re: How to reset the idle timer?
Stefan Monnier via Users list for the GNU Emacs text editor <[email protected]>
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <[email protected]> |
>> Here is my use case. When I close my laptop (not sure what it's >> technically called - sleep? hibernation?), and then open it again (say, >> after a few hours), I'd like Emacs to set up an idle timer to do >> something, say, 1 minute after I stop pressing any buttons. I have >> a (not great, but working) way to run some Elisp after I open my laptop, >> but when I set up an idle timer then, it runs immediately, since the >> idle time is several hours. I'd like to reset that idle time so that my >> idle timer will really run after 1 minute of idleness - so, 1 minute >> /after/ opening the laptop if I don't do anything else, and later if >> I do something in Emacs within 60 seconds of opening my laptop. > > When the laptop is open, call run-with-timer to set up a normal > (non-idle) timer that runs 1 min after that, and in the timer function > of that timer start an idle timer. This is actually an ideal use-case for Daniel Colascione's recent suggestion to change `(run-with-idle-timer N ...)` to mean that N starts counting *now* rather than starting counting when the current idle period started. === Stefan