From: murata Date: Fri, 12 May 2000 14:23:54 +0000 (+0000) Subject: * elmo-vars.el (elmo-display-progress-threshold): New variable. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3843bc601979a28fc1e103f949caa7162a8e38e9;p=elisp%2Fwanderlust.git * elmo-vars.el (elmo-display-progress-threshold): New variable. All other related modules are changed. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index dd52203..75ffa01 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,8 @@ +2000-05-12 Masahiro MURATA + + * elmo-vars.el (elmo-display-progress-threshold): New variable. + All other related modules are changed. + 2000-05-11 Yuuichi Teranishi * elmo-msgdb.el (elmo-msgdb-sort-by-date): Fixed a problem diff --git a/elmo/elmo-archive.el b/elmo/elmo-archive.el index 39d32a1..887f8d6 100644 --- a/elmo/elmo-archive.el +++ b/elmo/elmo-archive.el @@ -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))) diff --git a/elmo/elmo-cache.el b/elmo/elmo-cache.el index e6dad86..100e4e0 100644 --- a/elmo/elmo-cache.el +++ b/elmo/elmo-cache.el @@ -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))) diff --git a/elmo/elmo-dop.el b/elmo/elmo-dop.el index 09c8aaf..2f2e0a9 100644 --- a/elmo/elmo-dop.el +++ b/elmo/elmo-dop.el @@ -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")) diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 66f3d0b..db2c30d 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -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) diff --git a/elmo/elmo-internal.el b/elmo/elmo-internal.el index 2c5fd14..3624e67 100644 --- a/elmo/elmo-internal.el +++ b/elmo/elmo-internal.el @@ -141,11 +141,12 @@ 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)))) diff --git a/elmo/elmo-localdir.el b/elmo/elmo-localdir.el index 068b076..4c919eb 100644 --- a/elmo/elmo-localdir.el +++ b/elmo/elmo-localdir.el @@ -152,11 +152,12 @@ 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)))) @@ -360,10 +361,11 @@ (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))) @@ -404,9 +406,11 @@ (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 @@ -425,7 +429,6 @@ (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) diff --git a/elmo/elmo-maildir.el b/elmo/elmo-maildir.el index f8db6de..32e1bf6 100644 --- a/elmo/elmo-maildir.el +++ b/elmo/elmo-maildir.el @@ -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 diff --git a/elmo/elmo-nntp.el b/elmo/elmo-nntp.el index 0c3c558..2fa6b64 100644 --- a/elmo/elmo-nntp.el +++ b/elmo/elmo-nntp.el @@ -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) diff --git a/elmo/elmo-pop3.el b/elmo/elmo-pop3.el index a30e20e..84e2296 100644 --- a/elmo/elmo-pop3.el +++ b/elmo/elmo-pop3.el @@ -476,16 +476,15 @@ (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) @@ -574,14 +573,12 @@ (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) diff --git a/elmo/elmo-vars.el b/elmo/elmo-vars.el index dd179b7..1356770 100644 --- a/elmo/elmo-vars.el +++ b/elmo/elmo-vars.el @@ -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 diff --git a/elmo/elmo2.el b/elmo/elmo2.el index abd4546..47e1e98 100644 --- a/elmo/elmo2.el +++ b/elmo/elmo2.el @@ -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)