* elmo-vars.el (elmo-display-progress-threshold): New variable.
authormurata <murata>
Fri, 12 May 2000 14:23:54 +0000 (14:23 +0000)
committermurata <murata>
Fri, 12 May 2000 14:23:54 +0000 (14:23 +0000)
All other related modules are changed.

12 files changed:
elmo/ChangeLog
elmo/elmo-archive.el
elmo/elmo-cache.el
elmo/elmo-dop.el
elmo/elmo-imap4.el
elmo/elmo-internal.el
elmo/elmo-localdir.el
elmo/elmo-maildir.el
elmo/elmo-nntp.el
elmo/elmo-pop3.el
elmo/elmo-vars.el
elmo/elmo2.el

index dd52203..75ffa01 100644 (file)
@@ -1,3 +1,8 @@
+2000-05-12  Masahiro MURATA  <muse@ba2.so-net.ne.jp>
+
+       * elmo-vars.el (elmo-display-progress-threshold): New variable.
+       All other related modules are changed.
+
 2000-05-11  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * elmo-msgdb.el (elmo-msgdb-sort-by-date): Fixed a problem
index 39d32a1..887f8d6 100644 (file)
@@ -833,11 +833,12 @@ TYPE specifies the archiver's symbol."
                     mark-alist
                     (elmo-msgdb-overview-entity-get-number entity)
                     gmark))))
-       (setq i (1+ i))
-       (setq percent (/ (* i 100) num))
-       (elmo-display-progress
-        'elmo-archive-msgdb-create-as-numlist-subr1 "Creating msgdb..."
-        percent)
+       (when (> num elmo-display-progress-threshold)
+         (setq i (1+ i))
+         (setq percent (/ (* i 100) num))
+         (elmo-display-progress
+          'elmo-archive-msgdb-create-as-numlist-subr1 "Creating msgdb..."
+          percent))
        (setq numlist (cdr numlist)))
       (kill-buffer tmp-buf)
       (message "Creating msgdb...done.")
@@ -895,11 +896,12 @@ TYPE specifies the archiver's symbol."
 ;      (setq mark-alist (append mark-alist (nth 2 result))))
        (t                      ;; unknown format
        (error "unknown format!")))
-      (setq i (+ n i))
-      (setq percent (/ (* i 100) num))
-      (elmo-display-progress
-       'elmo-archive-msgdb-create-as-numlist-subr2 "Creating msgdb..."
-       percent))
+      (when (> num elmo-display-progress-threshold)
+       (setq i (+ n i))
+       (setq percent (/ (* i 100) num))
+       (elmo-display-progress
+        'elmo-archive-msgdb-create-as-numlist-subr2 "Creating msgdb..."
+        percent)))
     (kill-buffer buf)
     (list overview number-alist mark-alist)) )
 
@@ -986,10 +988,11 @@ TYPE specifies the archiver's symbol."
                                              condition
                                              (nth 3 spec))
          (setq ret-val (cons (car msgs) ret-val)))
-      (setq i (1+ i))
-      (elmo-display-progress
-       'elmo-archive-search "Searching..."
-       (/ (* i 100) num))
+      (when (> num elmo-display-progress-threshold)
+       (setq i (1+ i))
+       (elmo-display-progress
+        'elmo-archive-search "Searching..."
+        (/ (* i 100) num)))
       (setq msgs (cdr msgs)))
     (nreverse ret-val)))
 
index e6dad86..100e4e0 100644 (file)
@@ -203,11 +203,13 @@ If KBYTES is kilo bytes (This value must be float)."
                                    (lambda (x y)
                                      (< (cdr x)
                                         (cdr y))))))))
-      (setq i (+ i 1))
-      (elmo-display-progress
-       'elmo-cache-get-sorted-cache-file-list "Collecting cache info..."
-       (/ (* i 100) num))
+      (when (> num elmo-display-progress-threshold)
+       (setq i (+ i 1))
+       (elmo-display-progress
+        'elmo-cache-get-sorted-cache-file-list "Collecting cache info..."
+        (/ (* i 100) num)))
       (setq dirs (cdr dirs)))
+    (message "Collecting cache info...done.")
     ret-val))
 
 (defun elmo-cache-expire-by-age (&optional days)
@@ -295,11 +297,12 @@ If KBYTES is kilo bytes (This value must be float)."
                                                     (car (car nalist))))
               (elmo-file-field-condition-match cache-file condition))
          (setq ret-val (append ret-val (list (caar nalist)))))
-      (setq i (1+ i))
-      (setq percent (/ (* i 100) num))
-      (elmo-display-progress
-       'elmo-cache-search-all "Searching..."
-       percent)
+      (when (> num elmo-display-progress-threshold)
+       (setq i (1+ i))
+       (setq percent (/ (* i 100) num))
+       (elmo-display-progress
+        'elmo-cache-search-all "Searching..."
+        percent))
       (setq nalist (cdr nalist)))
     ret-val))
 
@@ -533,11 +536,12 @@ Returning its cache buffer."
                     mark-alist 
                     num
                     gmark))))
-       (setq i (1+ i))
-       (setq percent (/ (* i 100) len))
-       (elmo-display-progress
-        'elmo-cache-msgdb-create-as-numlist "Creating msgdb..."
-        percent)
+       (when (> len elmo-display-progress-threshold)
+         (setq i (1+ i))
+         (setq percent (/ (* i 100) len))
+         (elmo-display-progress
+          'elmo-cache-msgdb-create-as-numlist "Creating msgdb..."
+          percent))
        (setq numlist (cdr numlist)))
       (message "Creating msgdb...done.")
       (list overview number-alist mark-alist))))
@@ -685,10 +689,11 @@ Returning its cache buffer."
            (elmo-cache-get-folder-directory spec))
                                            condition)
          (setq ret-val (cons (car msgs) ret-val)))
-      (setq i (1+ i))
-      (elmo-display-progress
-       'elmo-cache-search "Searching..."
-       (/ (* i 100) num))
+      (when (> num elmo-display-progress-threshold)
+       (setq i (1+ i))
+       (elmo-display-progress
+        'elmo-cache-search "Searching..."
+        (/ (* i 100) num)))
       (setq msgs (cdr msgs)))
     (nreverse ret-val)))
 
index 09c8aaf..2f2e0a9 100644 (file)
@@ -538,11 +538,12 @@ even an operation concerns the unplugged folder."
                      (setq mark-alist
                            (elmo-msgdb-mark-append
                             mark-alist (car numlist) gmark)))))
-             (setq i (1+ i))
-             (setq percent (/ (* i 100) num))
-             (elmo-display-progress
-              'elmo-dop-msgdb-create-as-numlist "Creating msgdb..."
-              percent)
+             (when (> num elmo-display-progress-threshold)
+               (setq i (1+ i))
+               (setq percent (/ (* i 100) num))
+               (elmo-display-progress
+                'elmo-dop-msgdb-create-as-numlist "Creating msgdb..."
+                percent))
              (setq numlist (cdr numlist)))
            (list overview number-alist mark-alist))
        (error "Unplugged"))
index 66f3d0b..db2c30d 100644 (file)
@@ -1025,9 +1025,10 @@ If optional argument UNMARK is non-nil, unmark."
          (setq count (+ count (car (car set-list))))
          (setq ov-str (elmo-imap4-read-contents (process-buffer process)
                                                 process))
-         (elmo-display-progress
-          'elmo-imap4-msgdb-create "Getting overview..." 
-          (/ (* count 100) length))
+         (when (> length elmo-display-progress-threshold)
+           (elmo-display-progress
+            'elmo-imap4-msgdb-create "Getting overview..." 
+            (/ (* count 100) length)))
          (setq set-list (cdr set-list)))
        ;; process last one.
        (with-current-buffer (process-buffer process)
index 2c5fd14..3624e67 100644 (file)
                             entity))
                           already-mark
                         new-mark))))))
-       (setq i (1+ i))
-       (setq percent (/ (* i 100) num))
-       (elmo-display-progress
-        'elmo-internal-msgdb-create "Creating msgdb..."
-        percent)
+       (when (> num elmo-display-progress-threshold)
+         (setq i (1+ i))
+         (setq percent (/ (* i 100) num))
+         (elmo-display-progress
+          'elmo-internal-msgdb-create "Creating msgdb..."
+          percent))
        (setq numlist (cdr numlist)))
       (message "Creating msgdb...done.")
       (list overview number-alist mark-alist loc-alist))))
index 068b076..4c919eb 100644 (file)
                     mark-alist 
                     num
                     gmark))))
-       (setq i (1+ i))
-       (setq percent (/ (* i 100) len))
-       (elmo-display-progress
-        'elmo-localdir-msgdb-create-as-numlist "Creating msgdb..."
-        percent)
+       (when (> len elmo-display-progress-threshold)
+         (setq i (1+ i))
+         (setq percent (/ (* i 100) len))
+         (elmo-display-progress
+          'elmo-localdir-msgdb-create-as-numlist "Creating msgdb..."
+          percent))
        (setq numlist (cdr numlist)))
       (message "Creating msgdb...done.")
       (list overview number-alist mark-alist))))
       (if (elmo-localdir-field-condition-match spec (car msgs)
                                               condition)
          (setq ret-val (cons (car msgs) ret-val)))
-      (setq i (1+ i))
-      (elmo-display-progress
-       'elmo-localdir-search "Searching..."
-       (/ (* i 100) num))
+      (when (> num elmo-display-progress-threshold)
+       (setq i (1+ i))
+       (elmo-display-progress
+        'elmo-localdir-search "Searching..."
+        (/ (* i 100) num)))
       (setq msgs (cdr msgs)))
     (nreverse ret-val)))
 
            (mapcar 'car onum-alist)))
     (setq total (length flist))
     (while flist
-      (elmo-display-progress
-       'elmo-localdir-pack-number "Packing..."
-       (/ (* i 100) total))
+      (setq i (1+ i))
+      (when (> total elmo-display-progress-threshold)
+       (elmo-display-progress
+        'elmo-localdir-pack-number "Packing..."
+        (/ (* i 100) total)))
       (setq onum (car flist))
       (when (not (eq onum i)) ;; why \=() is wrong..
         (elmo-bind-directory
              (elmo-msgdb-mark-append
               new-mark-alist
               i mark)))
-      (setq i (1+ i))
       (setq flist (cdr flist)))
     (message "Packing...done.")
     (list (elmo-msgdb-get-overview msgdb)
index f8db6de..32e1bf6 100644 (file)
@@ -223,11 +223,12 @@ This variable should not be used in elsewhere.")
                        (elmo-msgdb-overview-entity-get-id
                         entity))
                       new-mark)))))
-       (setq i (1+ i))
-       (setq percent (/ (* i 100) num))
-       (elmo-display-progress
-        'elmo-maildir-msgdb-create "Creating msgdb..."
-        percent)
+       (when (> num elmo-display-progress-threshold)
+         (setq i (1+ i))
+         (setq percent (/ (* i 100) num))
+         (elmo-display-progress
+          'elmo-maildir-msgdb-create "Creating msgdb..."
+          percent))
        (setq numlist (cdr numlist)))
       (message "Creating msgdb...done.")
       (elmo-msgdb-sort-by-date
index 0c3c558..2fa6b64 100644 (file)
@@ -409,25 +409,27 @@ Don't cache if nil.")
                      (setq ret-val (delete top-ng ret-val)))
                  (if (not (assoc top-ng ret-val))
                      (setq ret-val (nconc ret-val (list (list top-ng))))))
-               (setq i (1+ i))
-               (and (zerop (% i 10))
-                    (elmo-display-progress
-                     'elmo-nntp-list-folders "Parsing active..."
-                     (/ (* i 100) len)))
+               (when (> len elmo-display-progress-threshold)
+                 (setq i (1+ i))
+                 (if (or (zerop (% i 10)) (= i len))
+                     (elmo-display-progress
+                      'elmo-nntp-list-folders "Parsing active..."
+                      (/ (* i 100) len))))
                (forward-line 1)
                ))
          (while (re-search-forward "\\([^ ]+\\) .*\n" nil t)
            (setq ret-val (nconc ret-val
                                 (list (elmo-match-buffer 1))))
-           (setq i (1+ i))
-           (and (zerop (% i 10))
-                (elmo-display-progress
-                 'elmo-nntp-list-folders "Parsing active..."
-                 (/ (* i 100) len))))))
+           (when (> len elmo-display-progress-threshold)
+             (setq i (1+ i))
+             (if (or (zerop (% i 10)) (= i len))
+                 (elmo-display-progress
+                  'elmo-nntp-list-folders "Parsing active..."
+                  (/ (* i 100) len))))))
+       (when (> len elmo-display-progress-threshold)
+         (elmo-display-progress
+          'elmo-nntp-list-folders "Parsing active..." 100)))
       (kill-buffer tmp-buffer)
-      (elmo-display-progress
-       'elmo-nntp-list-folders "Parsing active..."
-       100)
       (unless (string= server elmo-default-nntp-server)
        (setq append-serv (concat "@" server)))
       (unless (eq port elmo-default-nntp-port)
@@ -683,11 +685,14 @@ Don't cache if nil.")
              (if (null (setq ov-str (elmo-nntp-read-contents buffer process)))
                  (error "Fetching overview failed")))
            (setq cur (+ elmo-nntp-overview-fetch-chop-length cur 1))
+           (when (> length elmo-display-progress-threshold)
+             (elmo-display-progress
+              'elmo-nntp-msgdb-create "Getting overview..." 
+              (/ (* (+ (- (min cur end-num)
+                          beg-num) 1) 100) length))))
+         (when (> length elmo-display-progress-threshold)
            (elmo-display-progress
-            'elmo-nntp-msgdb-create "Getting overview..." 
-            (/ (* (+ (- (min cur
-                             end-num)
-                        beg-num) 1) 100) length))))
+            'elmo-nntp-msgdb-create "Getting overview..." 100)))
        (if (not use-xover)
            (setq ret-val (elmo-nntp-msgdb-create-by-header
                           folder buffer process numlist
@@ -706,8 +711,6 @@ Don't cache if nil.")
                        important-mark
                        seen-list
                        filter))))))
-       (elmo-display-progress
-        'elmo-nntp-msgdb-create "Getting overview..." 100)
        ;; If there are canceled messages, overviews are not obtained
        ;; to max-number(inn 2.3?).
        (when (and (elmo-nntp-max-number-precedes-list-active-p)
@@ -1165,14 +1168,14 @@ Return nil if connection failed."
               (< received count))
        (accept-process-output process 1)
        (discard-input)
-       (and (zerop (% received 10))
-            (elmo-display-progress
-             'elmo-nntp-groups-read-response "Getting folders info..."
-             (/ (* received 100) count)))
-       )
-      (elmo-display-progress
-       'elmo-nntp-groups-read-response "Getting folders info..."
-       100)
+       (when (> count elmo-display-progress-threshold)
+         (if (or (zerop (% received 10)) (= received count))
+             (elmo-display-progress
+              'elmo-nntp-groups-read-response "Getting folders info..."
+              (/ (* received 100) count)))))
+      (when (> count elmo-display-progress-threshold)
+       (elmo-display-progress
+        'elmo-nntp-groups-read-response "Getting folders info..." 100))
       ;; Wait for the reply from the final command.
       (goto-char (point-max))
       (re-search-backward "^[0-9]" nil t)
@@ -1247,15 +1250,17 @@ Return nil if connection failed."
                     (setq last-point (point))
                     (setq received (1+ received)))
                   (< received count))
-           (and (zerop (% received 20))
-                (elmo-display-progress
-                 'elmo-nntp-retrieve-headers "Getting headers..."
-                 (/ (* received 100) number)))
+           (when (> number elmo-display-progress-threshold)
+             (if (or (zerop (% received 20)) (= received number))
+                 (elmo-display-progress
+                  'elmo-nntp-retrieve-headers "Getting headers..."
+                  (/ (* received 100) number))))
            (accept-process-output process 1)
            (discard-input)
            )))
-      (elmo-display-progress
-       'elmo-nntp-retrieve-headers "Getting headers..." 100)
+      (when (> number elmo-display-progress-threshold)
+       (elmo-display-progress
+        'elmo-nntp-retrieve-headers "Getting headers..." 100))
       (message "Getting headers...done")
       ;; Remove all "\r"'s.
       (goto-char (point-min))
@@ -1307,20 +1312,23 @@ Return nil if connection failed."
                                      nil
                                    already-mark)
                                (if seen
-                                   seen-mark
+                                   (if elmo-nntp-use-cache
+                                       seen-mark)
                                  new-mark))))
                    (setq mark-alist
                          (elmo-msgdb-mark-append 
                           mark-alist 
                           num gmark)))
                ))))
-       (setq i (1+ i))
-       (and (zerop (% i 20))
-            (elmo-display-progress
-             'elmo-nntp-msgdb-create-message "Creating msgdb..."
-             (/ (* i 100) len))))
-      (elmo-display-progress
-       'elmo-nntp-msgdb-create-message "Creating msgdb..." 100)
+       (when (> len elmo-display-progress-threshold)
+         (setq i (1+ i))
+         (if (or (zerop (% i 20)) (= i len))
+             (elmo-display-progress
+              'elmo-nntp-msgdb-create-message "Creating msgdb..."
+              (/ (* i 100) len)))))
+      (when (> len elmo-display-progress-threshold)
+       (elmo-display-progress
+        'elmo-nntp-msgdb-create-message "Creating msgdb..." 100))
       (list overview number-alist mark-alist))))
 
 (defun elmo-nntp-use-cache-p (spec number)
index a30e20e..84e2296 100644 (file)
                     (setq last-point (point))
                     (setq received (1+ received)))
                   (< received count))
-           (and (zerop (% received 20))
-                (elmo-display-progress
-                 'elmo-pop3-retrieve-headers "Getting headers..."
-                 (/ (* received 100) number)))
+           (when (> number elmo-display-progress-threshold)
+             (if (or (zerop (% received 5)) (= received number))
+                 (elmo-display-progress
+                  'elmo-pop3-retrieve-headers "Getting headers..."
+                  (/ (* received 100) number))))
            (accept-process-output process 1)
            ;(accept-process-output process)
            (discard-input)
            )))
-      (elmo-display-progress
-       'elmo-pop3-retrieve-headers "Getting headers..." 100)
       ;; Remove all "\r"'s.
       (goto-char (point-min))
       (while (search-forward "\r\n" nil t)
                         (elmo-msgdb-overview-entity-get-number entity)
                         gmark)))
              )))
-       (setq i (1+ i))
-       (and (zerop (% i 20))
-            (elmo-display-progress
-             'elmo-pop3-msgdb-create-message "Creating msgdb..."
-             (/ (* i 100) num)))
-       )
-      (elmo-display-progress
-       'elmo-pop3-msgdb-create-message "Creating msgdb..." 100)
+       (when (> num elmo-display-progress-threshold)
+         (setq i (1+ i))
+         (if (or (zerop (% i 5)) (= i num))
+             (elmo-display-progress
+              'elmo-pop3-msgdb-create-message "Creating msgdb..."
+              (/ (* i 100) num)))))
       (list overview number-alist mark-alist))))
 
 (defun elmo-pop3-read-body (buffer process outbuf)
index dd179b7..1356770 100644 (file)
@@ -330,6 +330,10 @@ set as non-nil.")
 (defvar elmo-use-decoded-cache t
   "Use cache of decode mime charset string.")
 
+(defvar elmo-display-progress-threshold 20
+  "*Displaying progress gauge
+if number of messages are more than this value.")
+
 (provide 'elmo-vars)
 
 ;;; elmo-vars.el ends here
index abd4546..47e1e98 100644 (file)
@@ -320,15 +320,16 @@ without cacheing."
        ;; delete src cache if it is partial.
        (elmo-cache-delete-partial message-id src-folder (car messages))
        (setq ret-val (append ret-val (list (car messages))))
-       (setq i (+ i 1))
-       (setq percent (/ (* i 100) all-msg-num))
-       (if no-delete 
+       (when (> all-msg-num elmo-display-progress-threshold)
+         (setq i (+ i 1))
+         (setq percent (/ (* i 100) all-msg-num))
+         (if no-delete 
+             (elmo-display-progress
+              'elmo-move-msgs "Copying messages..."
+              percent)
            (elmo-display-progress
-            'elmo-move-msgs "Copying messages..."
-            percent)
-         (elmo-display-progress
-          'elmo-move-msgs "Moving messages..."
-          percent))
+            'elmo-move-msgs "Moving messages..."
+            percent)))
        (setq messages (cdr messages)))
       ;; Save seen-list.
       (unless (eq dst-folder 'null)