From: teranisi Date: Mon, 25 Sep 2000 03:54:45 +0000 (+0000) Subject: 2000-09-25 Yuuichi Teranishi X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=47e488840acaab364cb3d9352eca0a06f9b4858a;p=elisp%2Fwanderlust.git 2000-09-25 Yuuichi Teranishi * wl.el (wl): Call `wl-folder-auto-check' after `wl-plugged-init'. * wl-util.el (wl-biff-notify): New inline function. (wl-biff-check-folders): Bind `elmo-network-session-name-prefix' locally. Call `wl-biff-check-folder-async' if length of `wl-biff-check- folder-list' is 1. Use `wl-biff-notify'. (wl-biff-check-folder-async-callback): New function. (wl-biff-check-folder-async): Ditto. * wl-folder.el (wl-folder): Don't check folders. (wl-folder-auto-check): New function. 2000-09-24 A. SAGATA * wl-util.el (wl-biff-start) [Emacs19+]: Use `timer-next-integral-multiple-of-time'. (wl-biff-check-folders): Use `wl-default-folder' if `wl-biff-check-folder-list' is nil. --- diff --git a/wl/ChangeLog b/wl/ChangeLog index 0cdab0d..0856bd1 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,26 @@ +2000-09-25 Yuuichi Teranishi + + * wl.el (wl): Call `wl-folder-auto-check' after `wl-plugged-init'. + + * wl-util.el (wl-biff-notify): New inline function. + (wl-biff-check-folders): Bind `elmo-network-session-name-prefix' + locally. + Call `wl-biff-check-folder-async' if length of `wl-biff-check- + folder-list' is 1. + Use `wl-biff-notify'. + (wl-biff-check-folder-async-callback): New function. + (wl-biff-check-folder-async): Ditto. + + * wl-folder.el (wl-folder): Don't check folders. + (wl-folder-auto-check): New function. + +2000-09-24 A. SAGATA + + * wl-util.el (wl-biff-start) [Emacs19+]: + Use `timer-next-integral-multiple-of-time'. + (wl-biff-check-folders): Use `wl-default-folder' + if `wl-biff-check-folder-list' is nil. + 2000-09-24 OKAZAKI Tetsurou * wl-summary.el (wl-summary-set-crosspost): Use `elmo-list-delete' diff --git a/wl/wl-folder.el b/wl/wl-folder.el index f04a897..9038b8e 100644 --- a/wl/wl-folder.el +++ b/wl/wl-folder.el @@ -1424,42 +1424,44 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'." (interactive "P") (let (initialize) ; (delete-other-windows) - (if (get-buffer wl-folder-buffer-name) - (switch-to-buffer wl-folder-buffer-name) - (switch-to-buffer (get-buffer-create wl-folder-buffer-name)) - (wl-folder-mode) - (wl-folder-init) - (set-buffer wl-folder-buffer-name) - (let ((inhibit-read-only t) - (buffer-read-only nil)) - (erase-buffer) - (setcdr (assoc (car wl-folder-entity) wl-folder-group-alist) t) - (save-excursion - (wl-folder-insert-entity " " wl-folder-entity))) - (set-buffer-modified-p nil) - (sit-for 0) - (setq initialize t)) - (if (not arg) - (progn - (run-hooks 'wl-auto-check-folder-pre-hook) - (cond - ((eq wl-auto-check-folder-name 'none)) - ((or (consp wl-auto-check-folder-name) - (stringp wl-auto-check-folder-name)) - (let ((folder-list (if (consp wl-auto-check-folder-name) - wl-auto-check-folder-name - (list wl-auto-check-folder-name))) - entity) - (while folder-list - (if (setq entity (wl-folder-search-entity-by-name - (car folder-list) - wl-folder-entity)) - (wl-folder-check-entity entity 'auto)) - (setq folder-list (cdr folder-list))))) - (t - (wl-folder-check-entity wl-folder-entity 'auto))) - (run-hooks 'wl-auto-check-folder-hook))) - initialize)) + (if (get-buffer wl-folder-buffer-name) + (switch-to-buffer wl-folder-buffer-name) + (switch-to-buffer (get-buffer-create wl-folder-buffer-name)) + (wl-folder-mode) + (wl-folder-init) + (set-buffer wl-folder-buffer-name) + (let ((inhibit-read-only t) + (buffer-read-only nil)) + (erase-buffer) + (setcdr (assoc (car wl-folder-entity) wl-folder-group-alist) t) + (save-excursion + (wl-folder-insert-entity " " wl-folder-entity))) + (set-buffer-modified-p nil) + ;(sit-for 0) + (setq initialize t)) + initialize)) + +(defun wl-folder-auto-check () + "Check and update folders in `wl-auto-check-folder-name'." + (interactive) + (when (get-buffer wl-folder-buffer-name) + (switch-to-buffer wl-folder-buffer-name) + (cond + ((eq wl-auto-check-folder-name 'none)) + ((or (consp wl-auto-check-folder-name) + (stringp wl-auto-check-folder-name)) + (let ((folder-list (if (consp wl-auto-check-folder-name) + wl-auto-check-folder-name + (list wl-auto-check-folder-name))) + entity) + (while folder-list + (if (setq entity (wl-folder-search-entity-by-name + (car folder-list) + wl-folder-entity)) + (wl-folder-check-entity entity 'auto)) + (setq folder-list (cdr folder-list))))) + (t + (wl-folder-check-entity wl-folder-entity 'auto))))) (defun wl-folder-set-folder-updated (name value) (save-excursion diff --git a/wl/wl-util.el b/wl/wl-util.el index 2e7a708..9c359e1 100644 --- a/wl/wl-util.el +++ b/wl/wl-util.el @@ -912,8 +912,11 @@ that `read' can handle, whenever this is possible." (defun wl-biff-start () (when wl-biff-check-folder-list (wl-biff-check-folders) - (put 'wl-biff 'timer (run-at-time t wl-biff-check-interval - 'wl-biff-event-handler)))) + (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. @@ -976,24 +979,55 @@ This function is imported from Emacs 20.7." (fset 'wl-biff-stop 'ignore) (fset 'wl-biff-start 'ignore))) +(defsubst wl-biff-notify (new-mails notify-minibuf) + (setq wl-modeline-biff-status (> new-mails 0)) + (force-mode-line-update t) + (when notify-minibuf + (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))))) + (defun wl-biff-check-folders () (interactive) (when (interactive-p) (message "Checking new mails...")) (let ((new-mails 0) - (flist (or wl-biff-check-folder-list '("%inbox"))) + (flist (or wl-biff-check-folder-list (list wl-default-folder))) + (elmo-network-session-name-prefix "BIFF-") folder) - (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-modeline-biff-status (> new-mails 0)) - (force-mode-line-update t) - (when (interactive-p) - (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)))))) + (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))))) + +(defun wl-biff-check-folder-async-callback (diff data) + (if (nth 1 data) + (with-current-buffer (nth 1 data) + (wl-folder-entity-hashtb-set wl-folder-entity-hashtb (nth 0 data) + (list (car diff) 0 (cdr diff)) + (current-buffer)))) + (setq wl-folder-info-alist-modified t) + (sit-for 0) + (wl-biff-notify (car diff) (nth 2 data))) + +(defun wl-biff-check-folder-async (folder notify-minibuf) + (when (elmo-folder-plugged-p folder) + (if (and (eq (elmo-folder-get-type folder) 'imap4) + (wl-folder-use-server-diff-p folder)) + ;; Check asynchronously only when IMAP4 and use server diff. + (progn + (setq elmo-folder-diff-async-callback + 'wl-biff-check-folder-async-callback) + (setq elmo-folder-diff-async-callback-data + (list folder (get-buffer wl-folder-buffer-name) + notify-minibuf)) + (elmo-folder-diff-async folder)) + (wl-biff-notify (car (wl-folder-check-one-entity folder)) + notify-minibuf)))) ;;; wl-util.el ends here diff --git a/wl/wl.el b/wl/wl.el index c079192..5d2517f 100644 --- a/wl/wl.el +++ b/wl/wl.el @@ -738,12 +738,14 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'." "Start Wanderlust -- Yet Another Message Interface On Emacsen. If prefix argument is specified, folder checkings are skipped." (interactive "P") - (unless wl-init - (wl-load-profile)) - (wl-plugged-init (null (get-buffer wl-folder-buffer-name))) + (or wl-init (wl-load-profile)) (unwind-protect (wl-init arg) - (wl-folder 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))