* wl-summary (wl-summary-prefetch): Don't prefetch if cached.
authorokada <okada>
Sat, 14 Oct 2000 22:35:43 +0000 (22:35 +0000)
committerokada <okada>
Sat, 14 Oct 2000 22:35:43 +0000 (22:35 +0000)
(wl-summary-prefetch-msg): force prefetch if called with optional argument.

doc/wl-ja.texi
wl/ChangeLog
wl/wl-summary.el

index 25339ef..f9a4f5c 100644 (file)
@@ -3006,6 +3006,8 @@ prefix argument \e$B$D$-$G<B9T$9$k$H2>A[%U%)%k%@$+$iC&=P$7$^$9!#\e(B
 @item i
 @kindex i (Summary)
 \e$B%+!<%=%k9T$N%a%C%;!<%8$r%W%j%U%'%C%A$7$^$9!#\e(B
+prefix argument \e$B$D$-$J$i$P$9$G$K%-%c%C%7%e$5$l$F$$$k%a%C%;!<%8$b\e(B
+\e$B:FEY%W%j%U%'%C%A$7$^$9!#\e(B
 @findex wl-summary-prefetch
 (@code{wl-summary-prefetch})
 
index 98b850a..0d0f3d8 100644 (file)
@@ -1,3 +1,8 @@
+2000-10-15  Kenichi OKADA  <okada@opaopa.org>
+
+       * wl-summary (wl-summary-prefetch): Don't prefetch if cached.
+       (wl-summary-prefetch-msg): force prefetch if called with optional argument.
+
 2000-10-13  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * wl-thread.el (wl-thread-msg-mark-as-read): Abolished.
index 62540a9..d2886c3 100644 (file)
@@ -1344,7 +1344,7 @@ If optional argument is non-nil, checking is omitted."
   (wl-summary-prefetch-region (point-min) (point-max)
                              wl-summary-incorporate-marks))
 
-(defun wl-summary-prefetch-msg (number)
+(defun wl-summary-prefetch-msg (number &optional arg)
   "Returns status-mark. if skipped, returns nil."
   ;; prefetching procedure.
   (save-excursion
@@ -1362,86 +1362,88 @@ If optional argument is non-nil, checking is omitted."
                            (or (null wl-prefetch-threshold)
                                (< size wl-prefetch-threshold))))
           mark new-mark)
-      (unwind-protect
-         (progn
-           (when (and size (not force-read) wl-prefetch-confirm)
-             (setq force-read
-                   (save-restriction
-                     (widen)
-                     (y-or-n-p
-                      (format
-                       "Message from %s has %d bytes. Prefetch it?"
-                       (concat
-                        "[ "
-                        (save-match-data
-                          (wl-set-string-width
-                           wl-from-width
-                           (wl-summary-from-func-internal
-                            (eword-decode-string
-                             (elmo-delete-char
-                              ?\"
-                              (or
-                               (elmo-msgdb-overview-entity-get-from ov)
-                               "??")))))) " ]")
-                       size))))
-             (message "")); flush.
-           (setq mark (cadr (assq number mark-alist)))
-            (if force-read
-             (save-excursion
-               (save-match-data
-                 (if (and (null (elmo-folder-plugged-p
-                                 wl-summary-buffer-folder-name))
-                          elmo-enable-disconnected-operation)
-                     (progn ;; append-queue for offline
-                       (elmo-dop-prefetch-msgs
-                        wl-summary-buffer-folder-name (list number))
-                       (setq new-mark
-                             (cond
-                              ((string= mark
-                                        wl-summary-unread-uncached-mark)
-                               wl-summary-unread-cached-mark)
-                              ((string= mark wl-summary-new-mark)
-                               (setq wl-summary-buffer-new-count
-                                     (- wl-summary-buffer-new-count 1))
-                               (setq wl-summary-buffer-unread-count
-                                     (+ wl-summary-buffer-unread-count 1))
-                               wl-summary-unread-cached-mark)
-                              ((or (null mark)
-                                   (string= mark wl-summary-read-uncached-mark))
-                               (setq wl-summary-buffer-unread-count
-                                     (+ wl-summary-buffer-unread-count 1))
-                               wl-summary-unread-cached-mark)
-                              (t mark))))
-                   ;; online
-                   (elmo-prefetch-msg wl-summary-buffer-folder-name
-                                      number
-                                      (wl-message-get-original-buffer)
-                                      msgdb)
-                   (setq new-mark
-                         (cond
-                          ((string= mark
-                                    wl-summary-unread-uncached-mark)
-                           wl-summary-unread-cached-mark)
-                          ((string= mark wl-summary-new-mark)
-                           (setq wl-summary-buffer-new-count
-                                 (- wl-summary-buffer-new-count 1))
-                           (setq wl-summary-buffer-unread-count
-                                 (+ wl-summary-buffer-unread-count 1))
-                           wl-summary-unread-cached-mark)
-                          ((string= mark wl-summary-read-uncached-mark)
-                           nil)
-                          (t mark))))
-                 (setq mark-alist (elmo-msgdb-mark-set
-                                   mark-alist number new-mark))
-                 (or new-mark (setq new-mark " "))
-                 (elmo-msgdb-set-mark-alist msgdb mark-alist)
-                 (wl-summary-set-mark-modified)
-                 (wl-summary-update-modeline)
-                 (wl-folder-update-unread
-                  wl-summary-buffer-folder-name
-                  (+ wl-summary-buffer-unread-count
-                     wl-summary-buffer-new-count)))
-               new-mark)))))))
+      (if (or arg
+             (null (elmo-cache-exists-p message-id)))
+         (unwind-protect
+             (progn
+               (when (and size (not force-read) wl-prefetch-confirm)
+                 (setq force-read
+                       (save-restriction
+                         (widen)
+                         (y-or-n-p
+                          (format
+                           "Message from %s has %d bytes. Prefetch it?"
+                           (concat
+                            "[ "
+                            (save-match-data
+                              (wl-set-string-width
+                               wl-from-width
+                               (wl-summary-from-func-internal
+                                (eword-decode-string
+                                 (elmo-delete-char
+                                  ?\"
+                                  (or
+                                   (elmo-msgdb-overview-entity-get-from ov)
+                                   "??")))))) " ]")
+                           size))))
+                 (message ""))         ; flush.
+               (setq mark (cadr (assq number mark-alist)))
+               (if force-read
+                   (save-excursion
+                     (save-match-data
+                       (if (and (null (elmo-folder-plugged-p
+                                       wl-summary-buffer-folder-name))
+                                elmo-enable-disconnected-operation)
+                           (progn;; append-queue for offline
+                             (elmo-dop-prefetch-msgs
+                              wl-summary-buffer-folder-name (list number))
+                             (setq new-mark
+                                   (cond
+                                    ((string= mark
+                                              wl-summary-unread-uncached-mark)
+                                     wl-summary-unread-cached-mark)
+                                    ((string= mark wl-summary-new-mark)
+                                     (setq wl-summary-buffer-new-count
+                                           (- wl-summary-buffer-new-count 1))
+                                     (setq wl-summary-buffer-unread-count
+                                           (+ wl-summary-buffer-unread-count 1))
+                                     wl-summary-unread-cached-mark)
+                                    ((or (null mark)
+                                         (string= mark wl-summary-read-uncached-mark))
+                                     (setq wl-summary-buffer-unread-count
+                                           (+ wl-summary-buffer-unread-count 1))
+                                     wl-summary-unread-cached-mark)
+                                    (t mark))))
+                         ;; online
+                         (elmo-prefetch-msg wl-summary-buffer-folder-name
+                                            number
+                                            (wl-message-get-original-buffer)
+                                            msgdb)
+                         (setq new-mark
+                               (cond
+                                ((string= mark
+                                          wl-summary-unread-uncached-mark)
+                                 wl-summary-unread-cached-mark)
+                                ((string= mark wl-summary-new-mark)
+                                 (setq wl-summary-buffer-new-count
+                                       (- wl-summary-buffer-new-count 1))
+                                 (setq wl-summary-buffer-unread-count
+                                       (+ wl-summary-buffer-unread-count 1))
+                                 wl-summary-unread-cached-mark)
+                                ((string= mark wl-summary-read-uncached-mark)
+                                 nil)
+                                (t mark))))
+                       (setq mark-alist (elmo-msgdb-mark-set
+                                         mark-alist number new-mark))
+                       (or new-mark (setq new-mark " "))
+                       (elmo-msgdb-set-mark-alist msgdb mark-alist)
+                       (wl-summary-set-mark-modified)
+                       (wl-summary-update-modeline)
+                       (wl-folder-update-unread
+                        wl-summary-buffer-folder-name
+                        (+ wl-summary-buffer-unread-count
+                           wl-summary-buffer-new-count)))
+                     new-mark))))))))
 
 ;(defvar wl-summary-message-uncached-marks
 ;  (list wl-summary-new-mark
@@ -1512,9 +1514,9 @@ If optional argument is non-nil, checking is omitted."
        (message "Prefetched %d/%d message(s)" count length)
        (cons count length)))))
 
-(defun wl-summary-prefetch ()
+(defun wl-summary-prefetch (&optional arg)
   "Prefetch current message."
-  (interactive)
+  (interactive "P")
   (save-excursion
     (save-match-data
       (beginning-of-line)
@@ -1524,7 +1526,7 @@ If optional argument is non-nil, checking is omitted."
              (buffer-read-only nil)
              mark)
          (setq mark (wl-summary-prefetch-msg
-                     (string-to-int (wl-match-buffer 1))))
+                     (string-to-int (wl-match-buffer 1)) arg))
          (when mark
            (delete-region (match-beginning 2)
                           (match-end 2))