From 1f0f253420ee1ac1682d88fc905842ac2900b872 Mon Sep 17 00:00:00 2001 From: teranisi Date: Mon, 25 Sep 2000 09:21:23 +0000 Subject: [PATCH] * 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/ChangeLog | 13 +++++++++++++ wl/wl-util.el | 45 ++++++++++++++++++++++++++++----------------- wl/wl.el | 14 ++++++++------ 3 files changed, 49 insertions(+), 23 deletions(-) diff --git a/wl/ChangeLog b/wl/ChangeLog index 0856bd1..6cce28ba 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,5 +1,18 @@ 2000-09-25 Yuuichi Teranishi + * 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. diff --git a/wl/wl-util.el b/wl/wl-util.el index 9c359e1..b87f5e4 100644 --- a/wl/wl-util.el +++ b/wl/wl-util.el @@ -904,12 +904,12 @@ that `read' can handle, whenever this is possible." 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 @@ -986,24 +986,34 @@ This function is imported from Emacs 20.7." (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) @@ -1012,6 +1022,7 @@ This function is imported from Emacs 20.7." (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))) diff --git a/wl/wl.el b/wl/wl.el index 5d2517f..56124a9 100644 --- a/wl/wl.el +++ b/wl/wl.el @@ -742,12 +742,14 @@ If prefix argument is specified, folder checkings are skipped." (unwind-protect (wl-init arg) (wl-plugged-init (wl-folder arg)) - (sit-for 0) - (run-hooks 'wl-auto-check-folder-pre-hook) - (wl-folder-auto-check) - (run-hooks 'wl-auto-check-folder-hook)) - (wl-biff-start) - (run-hooks 'wl-hook)) + (sit-for 0)) + (unwind-protect + (progn + (run-hooks 'wl-auto-check-folder-pre-hook) + (wl-folder-auto-check) + (run-hooks 'wl-auto-check-folder-hook)) + (wl-biff-start) + (run-hooks 'wl-hook))) ;; Define some autoload functions WL might use. (eval-and-compile -- 1.7.10.4