Re: How to reset the idle timer?

Stefan Monnier <[email protected]>
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
> True, although I'd be /extremely/ curious to learn about a use-case
> depending on the current behavior so much that this change could
> break it!

My intuition tends to agree, but it's hard to be sure.
The current behavior is very explicitly documented in the docstring of
`run-with-idle-timer` since

    commit 171d328e8dd84e6d9e8d168e4e91fe989b65b138
    Author: Richard M. Stallman <[email protected]>
    Date:   Sun Aug 20 12:16:26 2006 +0000

    (run-with-idle-timer): Pass t to timer-activate-when-idle, so timer
    can run before Emacs becomes non-idle again.

Bugs #12447 and #12326 suggest this behavior is a source of bugs, but of
course that doesn't tell us if others are happy about the behavior
introduced 20 years ago.

FWIW, in [futur](https://elpa.gnu.org/packages/futur.html), I just added
a `futur-timeout-idle` which is supposed to implement the behavior
I described.  You could use it as follows:

    (require futur)

    (futur-bind
     (futur-timeout-idle 30)
     (lambda (_)
       (message "30s of idle timeout have elapsed!")))

Beware: the implementation is hackish/ugly/experimental and it's only
been lightly tested.  IOW handle with care.  If it works well,
send me your praises, but if it doesn't, of course it's not my fault.


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