* elmo.el (elmo-folder-move-messages): Bind
[elisp/wanderlust.git] / elmo / elmo-imap4.el
index afa580f..c62d1a7 100644 (file)
@@ -1142,10 +1142,16 @@ Return nil if no complete line has arrived."
     (if (match-string 1)
        (if (< (point-max) (+ (point) (string-to-number (match-string 1))))
            (progn
-             (if elmo-imap4-display-literal-progress
-                 (message "Retrieving...(%d/%d bytes)"
+             (if (and elmo-imap4-display-literal-progress
+                      (> (string-to-number (match-string 1))
+                         elmo-display-retrieval-progress-threshold))
+                 (elmo-display-progress
+                  'elmo-display-retrieval-progress
+                  (format "Retrieving (%d/%d bytes)..."
                           (- (point-max) (point))
-                          (string-to-number (match-string 1))))
+                          (string-to-number (match-string 1)))
+                  (floor (* (/ (float (- (point-max) (point)))
+                               (string-to-number (match-string 1))) 100))))
              nil)
          (goto-char (+ (point) (string-to-number (match-string 1))))
          (elmo-imap4-find-next-line))
@@ -2455,7 +2461,8 @@ If optional argument REMOVE is non-nil, remove FLAG."
     (with-current-buffer (elmo-network-session-buffer session)
       (setq elmo-imap4-fetch-callback nil)
       (setq elmo-imap4-fetch-callback-data nil))
-    (setq elmo-imap4-display-literal-progress t)
+    (unless elmo-inhibit-display-retrieval-progress
+      (setq elmo-imap4-display-literal-progress t))
     (unwind-protect
        (setq response
              (elmo-imap4-send-command-wait session
@@ -2468,7 +2475,11 @@ If optional argument REMOVE is non-nil, remove FLAG."
                                             (or section "")
                                             )))
       (setq elmo-imap4-display-literal-progress nil))
-    (message "Retrieving...done.")
+    (unless elmo-inhibit-display-retrieval-progress
+      (elmo-display-progress 'elmo-imap4-display-literal-progress
+                            ""
+                            100)  ; remove progress bar.
+      (message "Retrieving...done."))
     (if (setq response (elmo-imap4-response-bodydetail-text
                        (elmo-imap4-response-value-all
                         response 'fetch)))