(wl-summary-prefetch-region):
[elisp/wanderlust.git] / wl / wl-summary.el
index d29abdd..9133842 100644 (file)
@@ -4,7 +4,7 @@
 
 ;; Author: Yuuichi Teranishi <teranisi@gohome.org>
 ;; Keywords: mail, net news
-;; Time-stamp: <2000-04-13 12:03:05 teranisi>
+;; Time-stamp: <00/04/21 12:32:28 teranisi>
 
 ;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen).
 
@@ -1424,7 +1424,7 @@ If optional argument is non-nil, checking is omitted."
        targets
        mark length
        entity msg
-       start-pos)
+       start-pos pos)
     (save-excursion
       (setq start-pos (point))
       (save-restriction
@@ -1472,10 +1472,12 @@ If optional argument is non-nil, checking is omitted."
                       (setq count (+ 1 count)) length))
          ;; redisplay!
          (save-excursion
-           (save-restriction
-             (widen)
-             (goto-char start-pos)
-             (sit-for 0)))
+           (setq pos (point))
+           (goto-char start-pos)
+           (if (pos-visible-in-window-p pos)
+               (save-restriction
+                 (widen)
+                 (sit-for 0))))
          (setq targets (cdr targets)))
        (message "Prefetched %d/%d message(s)" count length)
        (cons count length)))))
@@ -2012,9 +2014,10 @@ If optional argument is non-nil, checking is omitted."
   "Update marks in summary."
   (interactive)
   (let ((plugged (elmo-folder-plugged-p wl-summary-buffer-folder-name))
+       (last-progress 0)
        mark-alist unread-marks msgs mark importants unreads 
        importants-in-db unreads-in-db has-imap4 diff diffs
-       mes)
+       mes num-ma ma-length progress)
     ;; synchronize marks.
     (when (not (eq (elmo-folder-get-type 
                    wl-summary-buffer-folder-name)
@@ -2024,6 +2027,8 @@ If optional argument is non-nil, checking is omitted."
                               wl-summary-unread-uncached-mark
                               wl-summary-new-mark)
            mark-alist (elmo-msgdb-get-mark-alist wl-summary-buffer-msgdb)
+            num-ma (length mark-alist)
+           ma-length num-ma
            importants (elmo-list-folder-important 
                        wl-summary-buffer-folder-name
                        (elmo-msgdb-get-overview wl-summary-buffer-msgdb))
@@ -2033,15 +2038,25 @@ If optional argument is non-nil, checking is omitted."
                        (elmo-list-folder-unread 
                         wl-summary-buffer-folder-name
                         mark-alist unread-marks)))
-      (while mark-alist 
+      (while mark-alist
+       (setq progress (/ (* (- num-ma ma-length) 100) num-ma))
+       (if (not (eq progress last-progress))
+           (elmo-display-progress 'wl-summary-sync-marks
+                                  "Updating marks..."
+                                  progress))
+       (setq last-progress progress)
        (if (string= (cadr (car mark-alist))
                     wl-summary-important-mark)
            (setq importants-in-db (cons (car (car mark-alist))
                                         importants-in-db))
          (if (member (cadr (car mark-alist)) unread-marks)
              (setq unreads-in-db (cons (car (car mark-alist))
-                                       unreads-in-db))))
-       (setq mark-alist (cdr mark-alist)))      
+                                       unreads-in-db))))
+       (setq mark-alist (cdr mark-alist)
+             ma-length (1- ma-length)))
+      (elmo-display-progress 'wl-summary-sync-marks
+                            "Updating marks..."
+                            100)
       (setq diff (elmo-list-diff importants importants-in-db))
       (setq diffs (cadr diff)) ; important-deletes
       (setq mes (format "Updated (-%d" (length diffs)))
@@ -2742,7 +2757,9 @@ If optional argument is non-nil, checking is omitted."
                  (save-excursion
                    (forward-line (- 
                                   0 
-                                  wl-summary-partial-highlight-above-lines))
+                                  (or
+                                   wl-summary-partial-highlight-above-lines
+                                   wl-summary-highlight-partial-threshold)))
                    (wl-highlight-summary (point) (point-max)))
                (wl-highlight-summary (point-min) (point-max))))
          (if (null wl-summary-buffer-msgdb) ;; one more try.