From: craffert@sps.ml.com (Colin Rafferty)
Subject: auto-get new mail
Date: Tue, 19 Dec 95 18:49:23 EST [thread overview]
Message-ID: <9512192349.AA10737@sparc10.sps.ml.com> (raw)
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
reply other threads:[~1995-12-19 23:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9512192349.AA10737@sparc10.sps.ml.com \
--to=craffert@sps.ml.com \
--cc=craffert@ml.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).