2000-09-25 Yuuichi Teranishi <teranisi@gohome.org>
+ * wl-util.el (wl-biff-check-folders-running): New variable.
+ (wl-biff-check-folders): Set and check `wl-biff-check-folders-running'.
+ (wl-biff-check-folder-async-callback):
+ Set `wl-biff-check-folders-running'.
+ (wl-biff-check-folders): Enclose `wl-folder-check-one-entity'
+ with unwind-protect.
+
+ * wl.el (wl): Call `wl-biff-start' before `wl-folder-auto-check'.
+ Enclose `wl-folder-auto-check' with unwind-protect.
+
+ * wl-util.el (wl-biff-start) [Emacs19+]: require 'timer.
+ (toplevel) [Emacs19+]: Removed autoload setting for "timer".
+
* wl.el (wl): Call `wl-folder-auto-check' after `wl-plugged-init'.
* wl-util.el (wl-biff-notify): New inline function.
wl-biff-check-interval wl-biff-check-interval))))
((condition-case nil (require 'timer) (error nil));; FSFmacs 19+
- (autoload 'run-at-time "timer")
(defun wl-biff-stop ()
(put 'wl-biff 'timer nil))
(defun wl-biff-start ()
+ (require 'timer)
(when wl-biff-check-folder-list
(wl-biff-check-folders)
(put 'wl-biff 'timer (run-at-time
(cond ((zerop new-mails) (message "No mail."))
((eq 1 new-mails) (message "You have a new mail."))
(t (message "You have %d new mails." new-mails)))))
-
+
+;; Internal variable.
+(defvar wl-biff-check-folders-running nil)
+
(defun wl-biff-check-folders ()
(interactive)
- (when (interactive-p)
- (message "Checking new mails..."))
- (let ((new-mails 0)
- (flist (or wl-biff-check-folder-list (list wl-default-folder)))
- (elmo-network-session-name-prefix "BIFF-")
- folder)
- (if (eq (length flist) 1)
- (wl-biff-check-folder-async (car flist) (interactive-p))
- (while flist
- (setq folder (car flist)
- flist (cdr flist))
- (when (elmo-folder-plugged-p folder)
- (setq new-mails (+ new-mails
- (nth 0 (wl-folder-check-one-entity folder))))))
- (wl-biff-notify new-mails (interactive-p)))))
+ (if wl-biff-check-folders-running
+ (when (interactive-p)
+ (message "Biff process is running."))
+ (setq wl-biff-check-folders-running t)
+ (when (interactive-p)
+ (message "Checking new mails..."))
+ (let ((new-mails 0)
+ (flist (or wl-biff-check-folder-list (list wl-default-folder)))
+ (elmo-network-session-name-prefix "BIFF-")
+ folder)
+ (if (eq (length flist) 1)
+ (wl-biff-check-folder-async (car flist) (interactive-p))
+ (unwind-protect
+ (while flist
+ (setq folder (car flist)
+ flist (cdr flist))
+ (when (elmo-folder-plugged-p folder)
+ (setq new-mails
+ (+ new-mails
+ (nth 0 (wl-folder-check-one-entity folder))))))
+ (setq wl-biff-check-folders-running nil)
+ (wl-biff-notify new-mails (interactive-p)))))))
(defun wl-biff-check-folder-async-callback (diff data)
(if (nth 1 data)
(list (car diff) 0 (cdr diff))
(current-buffer))))
(setq wl-folder-info-alist-modified t)
+ (setq wl-biff-check-folders-running nil)
(sit-for 0)
(wl-biff-notify (car diff) (nth 2 data)))