* wl-folder.el (wl-folder-init-hook): New hook.
[elisp/wanderlust.git] / wl / wl-folder.el
index 8d07931..c2e374c 100644 (file)
   (require 'wl)
   (require 'elmo-nntp))
 
+(defcustom wl-folder-init-hook nil
+  "A hook called after folder initialization is finished."
+  :type 'hook
+  :group 'wl)
+
 (defvar wl-folder-buffer-name "Folder")
 (defvar wl-folder-entity nil)          ; desktop entity.
 (defvar wl-folder-group-alist nil)     ; opened or closed
@@ -831,7 +836,6 @@ Optional argument ARG is repeart count."
                    (wl-summary-count-unread (elmo-msgdb-mark-load
                                              (elmo-folder-msgdb-path
                                               folder)))))
-      (setq unread (min unread (- (or (cdr nums) 0) (or (car nums) 0))))
       (when new (setq unread (- unread new)))
       (wl-folder-entity-hashtb-set wl-folder-entity-hashtb entity
                                   (list (or new (car nums))
@@ -841,8 +845,8 @@ Optional argument ARG is repeart count."
     (setq wl-folder-info-alist-modified t)
     (sit-for 0)
     (list (if wl-folder-notify-deleted
-             (or new (car nums))
-           (max 0 (or new (car nums))))
+             (or new (car nums) 0)
+           (max 0 (or new (car nums) 0)))
          unread
          (cdr nums))))
 
@@ -1997,7 +2001,8 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
   (interactive)
   (if wl-use-acap
       (wl-acap-init)
-    (funcall wl-folder-init-function)))
+    (funcall wl-folder-init-function))
+  (run-hooks 'wl-folder-init-hook))
 
 (defun wl-local-folder-init ()
   "Initialize local folder."