If you mean a way to run some code with idle timer in such a way that the passed code runs in the original buffer, maybe you can adapt the following snippet that I am currently using. Please keep in mind that this snippet assumes that it is placed in an *.el file with lexical binding.
(defun my-delayed-tex-font-lock ()
(let ((here (current-buffer)))
(run-with-idle-timer
10 nil
(lambda ()
(with-current-buffer here
(my-tex-font-lock))))))
(add-hook 'TeX-mode-hook 'my-delayed-tex-font-lock)
What this snippet does is make my function my-tex-font-lock run after ten seconds of idle time for each TeX file buffer. When I open alice.tex, quickly switch to bob.txt and wait for ten seconds doing nothing, then my-tex-font-lock will kick in and it will affect the alice.tex buffer but not bob.txt.
buffer-local
repeating idle-timer: stackoverflow.com/questions/24007822/… – lawlist May 19 '15 at 22:07