Re: [PATCH] Add variable wl-biff-check-idle-delay, because with wl-biff-use-idle-timer Wanderlust checks mail only once
Kazuhiro Ito <[email protected]>
| Newsgroups | gmane.mail.wanderlust.general |
|---|---|
| Message-ID | <86y3ydlwv6.wl--xmue__17849.4860804223$1484392372$gmane$org@d1.dion.ne.jp> |
> > > > > I wrote the patch to fix the below two problems. But because I don't > > > > > use wl-biff and it is very unstable in my environment, the patch is > > > > > not much tested. > > > > > > > > Thank you! I will try the patch and report any problems. > > > > > > The patch seems to work well after adding an "(unwind-protect ...)": > > > > I can't test it much. But it seems not to have bad effects, so I > > committed it into the repository with minor fix. > > Please test. > > Unfortunately it appears to have problems after all. They did not show > up before, but now that I changed my config a little and moved to the > latest WL it seems there are two issues: I wrote another fix for the timer related problem. As far as I tested, there is no too frequent firing timers for biff checker when wl-biff-use-idle-timer is non-nil. Moreover, wl-biff-check-delay should have effect on old platforms. Could you test it? -- Kazuhiro Ito
diff.diff
(application/octet-stream, 2.5 KB)
diff --git a/wl/wl-util.el b/wl/wl-util.el
index 79275c2..0795e74 100644
--- a/wl/wl-util.el
+++ b/wl/wl-util.el
@@ -775,17 +775,22 @@ that `read' can handle, whenever this is possible."
;; If biff timer already started, do nothing.
(unless (get 'wl-biff 'timers)
(put 'wl-biff 'timers
- (if wl-biff-use-idle-timer
- (list (run-with-idle-timer
- wl-biff-check-interval nil 'wl-biff-event-handler))
- (list (run-at-time wl-biff-check-interval nil
+ (list (if wl-biff-use-idle-timer
+ (run-with-idle-timer
+ wl-biff-check-interval t 'wl-biff-event-handler)
+ (run-at-time t wl-biff-check-interval
'wl-biff-launch-handler)))))
(message "No folder is specified for biff")))
(defun wl-biff-launch-handler ()
- (put 'wl-biff 'timers
- (run-with-idle-timer wl-biff-check-delay nil 'wl-biff-event-handler)))
+ (let ((timers (get 'wl-biff 'timers)))
+ (unless (or wl-biff-check-folders-running
+ (cdr timers))
+ (put 'wl-biff 'timers
+ (cons (run-with-idle-timer
+ wl-biff-check-delay nil 'wl-biff-event-handler)
+ timers)))))
(defun wl-biff-event-handler ()
;; PAKURing from FSF:time.el
@@ -797,20 +802,24 @@ that `read' can handle, whenever this is possible."
(message "wl-biff: %s (%s)" (car signal) (cdr signal))))
;; Do redisplay right now, if no input pending.
(sit-for 0))
- (wl-biff-stop)
(wl-biff-start)
- (let ((idle (and wl-biff-use-idle-timer
- ;; Available on Emacs 22 or later.
- (fboundp 'current-idle-time)
- (current-idle-time))))
- (when idle
- ;; Run idle timer for the case Emacs keeps idle.
- (put 'wl-biff 'timers
- (cons (run-with-idle-timer
- (+ wl-biff-check-interval (float-time idle))
- nil 'wl-biff-event-handler)
- (get 'wl-biff 'timers))))))
- )))
+ (put 'wl-biff 'timers
+ (let ((timers (get 'wl-biff 'timers)))
+ ;; Cancel existing extra idle timer (normaly only 1 at most).
+ (while (cdr timers)
+ (when (timerp (car timers)) (cancel-timer (car timers)))
+ (setq timers (cdr timers)))
+ (if (and wl-biff-use-idle-timer
+ ;; Available on Emacs 22 or later.
+ (fboundp 'current-idle-time))
+ ;; Run extra idle timer for the case Emacs keeps idle.
+ (cons (run-with-idle-timer
+ (+ wl-biff-check-interval
+ (float-time (current-idle-time)))
+ nil 'wl-biff-event-handler)
+ timers)
+ timers)))))
+ ))
(defsubst wl-biff-notify (new-mails notify-minibuf)