Function: gnus-demon-init

gnus-demon-init is an autoloaded, interactive and byte-compiled function defined in gnus-demon.el.gz.

Signature

(gnus-demon-init)

Documentation

Initialize the Gnus daemon.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-demon.el.gz
(defun gnus-demon-init ()
  "Initialize the Gnus daemon."
  (interactive)
  (gnus-demon-cancel)
  (dolist (handler gnus-demon-handlers)
    ;; Set up the timer.
    (let* ((func (nth 0 handler))
           (time (nth 1 handler))
           (idle (nth 2 handler))
           ;; Compute time according with timestep.
           ;; If t, replace by 1
           (time (cond ((eq time t)
                        gnus-demon-timestep)
                       ((null time)
			nil)
		       ((stringp time)
			(* (gnus-demon-time-to-step time) gnus-demon-timestep))
                       (t
			(* time gnus-demon-timestep))))
	   (idle (cond ((numberp idle)
			(* idle gnus-demon-timestep))
		       ((and (eq idle t) (numberp time))
			time)
		       (t
			idle)))

           (timer
            (cond
             ;; (func nil number)
             ;; Only call when Emacs has been idle for `idle'
             ((and (null time) (numberp idle))
              (run-with-idle-timer idle t 'gnus-demon-run-callback func))
             ;; (func number any)
             ;; Call every `time'
             ((integerp time)
              (run-with-timer time time 'gnus-demon-run-callback
			      func idle time))
             ;; (func string any)
             ((stringp time)
              (run-with-timer time (* 24 60 60) 'gnus-demon-run-callback
			      func idle)))))
      (when timer
        (setq gnus-demon-timers (plist-put gnus-demon-timers func timer))))))