Re: How to reset the idle timer?

[email protected]
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
On 2026-03-07, at 11:58, Stefan Monnier via Users list for the GNU Emacs text editor <[email protected]> wrote:

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

That is fascinating!  Is there a chance this suggestion will be
implemented soon?  I don't see any drawbacks (of course, I probably miss
something).

Best,

-- 
Marcin Borkowski
https://mbork.pl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.