From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/4522 Path: main.gmane.org!not-for-mail From: craffert@sps.ml.com (Colin Rafferty) Newsgroups: gmane.emacs.gnus.general Subject: auto-get new mail Date: Tue, 19 Dec 95 18:49:23 EST Message-ID: <9512192349.AA10737@sparc10.sps.ml.com> Reply-To: Colin Rafferty NNTP-Posting-Host: coloc-standby.netfonds.no X-Trace: main.gmane.org 1035145258 29924 80.91.224.250 (20 Oct 2002 20:20:58 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 20:20:58 +0000 (UTC) Return-Path: ding-request@ifi.uio.no Original-Received: from ifi.uio.no (ifi.uio.no [129.240.64.2]) by miranova.com (8.6.11/8.6.9) with ESMTP id QAA09211 for ; Tue, 19 Dec 1995 16:23:21 -0800 Original-Received: from njmlfire.ml.com (njmlfire.ml.com [198.242.49.1]) by ifi.uio.no with ESMTP (8.6.11/ifi2.4) id for ; Wed, 20 Dec 1995 00:50:26 +0100 Original-Received: from commpost.ml.com ([146.125.4.24]) by njmlfire.ml.com (8.6.12/8.6.12) with ESMTP id SAA24385 for ; Tue, 19 Dec 1995 18:49:22 -0500 Original-Received: from sparc10.sps.ml.com (sparc10.sps.ml.com [192.168.111.24]) by commpost.ml.com (8.6.12/8.6.12) with SMTP id SAA13947 for ; Tue, 19 Dec 1995 18:50:21 -0500 Original-Received: from spssunp.masdev.ml.com by sparc10.sps.ml.com (4.1/SMI-4.1) id AA10737; Tue, 19 Dec 95 18:49:23 EST Original-Received: by spssunp.masdev.ml.com (4.1/SMI-4.1) id AA07923; Tue, 19 Dec 95 18:49:16 EST Original-To: (ding) GNUS Mailing List X-Face: ByE+UMAp1klWR3?\RNGx(A-~Ri!YT%C6M!sxoJL+.;9`Q/|+dj7[KR>gGMyV.2qZeot0NI`4\MA^_Qg`F9=+Ox&zaE?Y9dV%F~Xzf';Zyk2Aobs.uu^Ey0_C6^~q';G#$HkA!ZAHXPpG-"*|Dd*Z4U$4y{{aI0c%75}i~Of(jxYtI[uIpYF<*Zoe|\*/ufb X-Y-Zippy: Yow! Maybe I should have asked for my Neutron Bomb in PAISLEY-- Xref: main.gmane.org gmane.emacs.gnus.general:4522 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:4522 Hi- The part of VM that I have missed the most is the vm-auto-get-new-mail variable. I have duplicated its effect within Gnus. Everything depends upon the fact that all your mail groups have a lower level the your non-mail groups, and that you use a normal mail spool (and that you have itimers on your flavor of Emacs). I have stolen the basic itimer setup from Kyle Jones (vm-summary.el). The remainder of this posting is the code that I have in my .gnus file that implements everything: (defvar cor:gnus-new-mail-interval 30 "*Time in which to automatically get new mail. 0 or non-numeric means don't get new mail.") (defvar cor:gnus-get-mail-level 2 "*Level at which the mail groups are.") (defvar cor:gnus-get-mail-delay 3 "*Time to sit before we check new mail.") (defvar cor:gnus-get-mail-hook nil "*Hook to run after new mail is automatically gotten.") (add-hook 'gnus-exit-gnus-hook 'cor:gnus-exit-itimers) (add-hook 'gnus-group-mode-hook 'cor:gnus-start-itimers-if-needed) (defun cor:gnus-exit-itimers () (condition-case () (delete-itimer "cor:gnus-new-mail") (t))) (defun cor:gnus-start-itimers-if-needed () (if (or (natnump cor:gnus-new-mail-interval)) (progn (if (null (condition-case nil (progn (require 'itimer) t) (error nil))) (setq cor:gnus-new-mail-interval nil) (and (natnump cor:gnus-new-mail-interval) (not (get-itimer "cor:gnus-new-mail")) (start-itimer "cor:gnus-new-mail" 'cor:gnus-get-mail-itimer-function cor:gnus-new-mail-interval nil)))))) ;; support for numeric cor:gnus-new-mail-interval (defun cor:gnus-get-mail-itimer-function () (if (integerp cor:gnus-new-mail-interval) (set-itimer-restart current-itimer cor:gnus-new-mail-interval)) (let ((gnus-group-use-permanent-levels nil)) (if (and (file-exists-p nnmail-spool-file) ;; file not empty? (< 0 (nth 7 (file-attributes (file-chase-links nnmail-spool-file)))) (not (input-pending-p)) (or (not (numberp cor:gnus-get-mail-delay)) (sit-for cor:gnus-get-mail-delay t))) (let ((b-list (buffer-list)) (gnus-verbose 0)) (while (and (not (input-pending-p)) b-list) (save-excursion (set-buffer (car b-list)) (if (eq major-mode 'gnus-group-mode) (progn (gnus-group-get-new-news cor:gnus-get-mail-level) (run-hooks 'cor:gnus-get-mail-hook)))) (setq b-list (cdr b-list))))))) ;Colin