* wl/wl-summary.el (wl-summary-mode): Check with fboundp before calling `make-local...
[elisp/wanderlust.git] / elmo / elmo-split.el
index 891ef41..630b707 100644 (file)
@@ -297,7 +297,7 @@ If prefix argument ARG is specified, do a reharsal (no harm)."
        (fcount 0)
        ret)
     (dolist (folder folders)
-      (setq ret (elmo-split-subr (elmo-make-folder folder) arg)
+      (setq ret (elmo-split-subr (elmo-get-folder folder) arg)
            count (+ count (car ret))
            fcount (+ fcount (cdr ret))))
     (run-hooks 'elmo-split-hook)
@@ -316,8 +316,7 @@ If prefix argument ARG is specified, do a reharsal (no harm)."
     count))
 
 (defun elmo-split-subr (folder &optional reharsal)
-  (let ((elmo-inhibit-display-retrieval-progress t)
-       (count 0)
+  (let ((count 0)
        (fcount 0)
        (default-rule `((t ,elmo-split-default-action)))
        msgs action target-folder failure delete-substance
@@ -325,28 +324,19 @@ If prefix argument ARG is specified, do a reharsal (no harm)."
     (message "Splitting...")
     (elmo-folder-open-internal folder)
     (setq msgs (elmo-folder-list-messages folder))
-    (elmo-progress-set 'elmo-split (length msgs) "Splitting...")
-    (unwind-protect
-       (progn
+    (elmo-with-progress-display (elmo-split (length msgs)) "Splitting messages"
+      (unwind-protect
          (with-temp-buffer
+           (set-buffer-multibyte nil)
            (dolist (msg msgs)
              (erase-buffer)
              (when (ignore-errors
                      (elmo-message-fetch folder msg
                                          (elmo-make-fetch-strategy 'entire)
-                                         nil (current-buffer) 'unread))
+                                         'unread))
                (run-hooks 'elmo-split-fetch-hook)
                (setq elmo-split-message-entity (mime-parse-buffer))
-               (setq flags
-                     (let ((this-id (elmo-message-field folder
-                                                        msg
-                                                        'message-id)))
-                       (and this-id
-                            (string= this-id
-                                     (elmo-msgdb-get-message-id-from-buffer))
-                            (or (elmo-message-flags folder msg)
-                                ;; message exists, but no flag.
-                                '(read)))))
+               (setq flags (elmo-message-flags-for-append folder msg))
                (catch 'terminate
                  (dolist (rule (append elmo-split-rule default-rule))
                    (setq elmo-split-match-string-internal nil)
@@ -367,7 +357,7 @@ If prefix argument ARG is specified, do a reharsal (no harm)."
                         ((stringp action)
                          (condition-case nil
                              (progn
-                               (setq target-folder (elmo-make-folder action))
+                               (setq target-folder (elmo-get-folder action))
                                (unless (elmo-folder-exists-p target-folder)
                                  (when
                                      (and
@@ -444,8 +434,7 @@ If prefix argument ARG is specified, do a reharsal (no harm)."
                      (unless (eq (nth 2 rule) 'continue)
                        (throw 'terminate nil))))))
              (elmo-progress-notify 'elmo-split)))
-         (elmo-folder-close-internal folder))
-      (elmo-progress-clear 'elmo-split))
+       (elmo-folder-close-internal folder)))
     (cons count fcount)))
 
 (require 'product)