* wl-util.el (wl-biff-start): Don't call `wl-biff-check-folders'
authoryoichi <yoichi>
Sat, 24 Jul 2004 20:07:05 +0000 (20:07 +0000)
committeryoichi <yoichi>
Sat, 24 Jul 2004 20:07:05 +0000 (20:07 +0000)
immediately.
* wl.el (wl): Call `wl-biff-check-folders' explicitly.
(wl-toggle-plugged): Ditto.

* wl-vars.el (wl-biff-use-idle-timer): New variable.
* wl-util.el (wl-biff-start): Use idle timer if
`wl-biff-use-idle-timer' is non-nil.

wl/ChangeLog
wl/wl-util.el
wl/wl-vars.el
wl/wl.el

index cbcaa10..9ce6758 100644 (file)
@@ -1,3 +1,14 @@
+2004-07-25  Yoichi NAKAYAMA  <yoichi@geiin.org>
+
+       * wl-util.el (wl-biff-start): Don't call `wl-biff-check-folders'
+       immediately.
+       * wl.el (wl): Call `wl-biff-check-folders' explicitly.
+       (wl-toggle-plugged): Ditto.
+
+       * wl-vars.el (wl-biff-use-idle-timer): New variable.
+       * wl-util.el (wl-biff-start): Use idle timer if
+       `wl-biff-use-idle-timer' is non-nil.
+
 2004-07-21  Yoichi NAKAYAMA  <yoichi@geiin.org>
 
        * wl-highlight.el (wl-highlight-message): Fix description.
index 654c8f0..c486788 100644 (file)
@@ -717,9 +717,9 @@ that `read' can handle, whenever this is possible."
   (defun wl-biff-start ()
     (wl-biff-stop)
     (when wl-biff-check-folder-list
-      (wl-biff-check-folders)
       (start-itimer wl-biff-timer-name 'wl-biff-check-folders
-                   wl-biff-check-interval wl-biff-check-interval))))
+                   wl-biff-check-interval wl-biff-check-interval
+                   wl-biff-use-idle-timer))))
 
  ((and (condition-case nil (require 'timer) (error nil));; FSFmacs 19+
        (fboundp 'timer-activate))
@@ -731,14 +731,27 @@ that `read' can handle, whenever this is possible."
   (defun wl-biff-start ()
     (require 'timer)
     (when wl-biff-check-folder-list
-      (wl-biff-check-folders)
-      (if (get 'wl-biff 'timer)
-         (timer-activate (get 'wl-biff 'timer))
-       (put 'wl-biff 'timer (run-at-time
+      (if wl-biff-use-idle-timer
+         (if (get 'wl-biff 'timer)
+             (progn (timer-set-idle-time (get 'wl-biff 'timer)
+                                         wl-biff-check-interval t)
+                    (timer-activate-when-idle (get 'wl-biff 'timer)))
+           (put 'wl-biff 'timer
+                (run-with-idle-timer
+                 wl-biff-check-interval t 'wl-biff-event-handler)))
+       (if (get 'wl-biff 'timer)
+           (progn
+             (timer-set-time (get 'wl-biff 'timer)
                              (timer-next-integral-multiple-of-time
                               (current-time) wl-biff-check-interval)
-                             wl-biff-check-interval
-                             'wl-biff-event-handler)))))
+                             wl-biff-check-interval)
+             (timer-activate (get 'wl-biff 'timer)))
+         (put 'wl-biff 'timer
+              (run-at-time
+               (timer-next-integral-multiple-of-time
+                (current-time) wl-biff-check-interval)
+               wl-biff-check-interval
+               'wl-biff-event-handler))))))
 
   (defun-maybe timer-next-integral-multiple-of-time (time secs)
     "Yield the next value after TIME that is an integral multiple of SECS.
index 5f20df4..3f6d4e7 100644 (file)
@@ -2072,6 +2072,11 @@ every intervals specified by wl-biff-check-interval."
   :type 'integer
   :group 'wl-highlight)
 
+(defcustom wl-biff-use-idle-timer nil
+  "Non-nil to use idle timer instead of strict timer for wl-biff"
+  :type 'boolean
+  :group 'wl-highlight)
+
 (defcustom wl-biff-state-indicator-on (if (and (featurep 'xemacs)
                                               (not (featurep 'mule)))
                                          "[Mail]"
index 3a371e6..d05e4d0 100644 (file)
--- a/wl/wl.el
+++ b/wl/wl.el
       (progn
        ;; flush queue!!
        (elmo-dop-queue-flush)
-       (unless queue-flush-only (wl-biff-start))
+       (unless queue-flush-only
+         (when wl-biff-check-folder-list
+           (wl-biff-check-folders)
+           (wl-biff-start)))
        (if (and wl-draft-enable-queuing
                 wl-auto-flush-queue)
            (wl-draft-queue-flush))
@@ -831,13 +834,15 @@ If ARG (prefix argument) is specified, folder checkings are skipped."
          (unless arg
            (run-hooks 'wl-auto-check-folder-pre-hook)
            (wl-folder-auto-check)
-           (run-hooks 'wl-auto-check-folder-hook))
-         (unless arg (wl-biff-start)))
+           (run-hooks 'wl-auto-check-folder-hook)))
       (error
        (if (buffer-live-p demo-buf)
           (kill-buffer demo-buf))
        (signal (car obj)(cdr obj)))
       (quit))
+    (when wl-biff-check-folder-list
+      (unless arg (wl-biff-check-folders))
+      (wl-biff-start))
     (if (buffer-live-p demo-buf)
        (kill-buffer demo-buf)))
   (run-hooks 'wl-hook))