Function: gnus-demon-run-callback

gnus-demon-run-callback is a byte-compiled function defined in gnus-demon.el.gz.

Signature

(gnus-demon-run-callback FUNC &optional IDLE TIME SPECIAL)

Documentation

Run FUNC if Emacs has been idle for longer than IDLE seconds.

If not, and a TIME is given, restart a new idle timer, so FUNC can be called at the next opportunity. Such a special idle run is marked with SPECIAL.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-demon.el.gz
(defun gnus-demon-run-callback (func &optional idle time special)
  "Run FUNC if Emacs has been idle for longer than IDLE seconds.
If not, and a TIME is given, restart a new idle timer, so FUNC
can be called at the next opportunity.  Such a special idle run
is marked with SPECIAL."
  (unless gnus-inhibit-demon
    (cl-block run-callback
      (when (eq idle t)
        (setq idle 0.001))
      (cond (special
             (setq gnus-demon-timers
                   (plist-put gnus-demon-timers func
                              (run-with-timer time time 'gnus-demon-run-callback
                                              func idle time))))
            ((and idle (> idle (gnus-demon-idle-since)))
             (when time
               (cancel-timer (plist-get gnus-demon-timers func))
               (setq gnus-demon-timers
                     (plist-put gnus-demon-timers func
				(run-with-idle-timer idle nil
						     'gnus-demon-run-callback
						     func idle time t))))
             (cl-return-from run-callback)))
      (with-local-quit
        (ignore-errors
          (funcall func))))))