1

I have a package which uses mouse motion, currently the idle timers aren't reset on mouse motion - causing idle timers to run, even when from a user perspective - Emacs is not idle.

How can I stop idle timers from running while my function runs?

ideasman42
  • 8,375
  • 1
  • 28
  • 105

1 Answers1

1

No idea whether this works, but what happens if you bind timer-idle-list to nil for the period when you want to prevent an idle timer from going off?

C-h v says that it's the list of active timers. If it's nil then maybe that will do what you want.

FWIW, I found timer-idle-list just by using C-h v and typing timer S-TAB, with Icicles (S-TAB does apropos completion). With vanilla Emacs you could just use M-x apropos RET timer RET to find it.


Otherwise, perhaps you could use cl-flet or similar to bind function current-idle-time for the duration to a function that just returns nil. Or just advise it to do only that.


(You could use cancel-timer on each of those active idle timers. But I don't think that's what you want to do.)

Drew
  • 75,699
  • 9
  • 109
  • 225