* wl-vars.el (wl-message-buffer-prefetch-depth): New variable.
authorokada <okada>
Sat, 19 Jan 2002 08:27:47 +0000 (08:27 +0000)
committerokada <okada>
Sat, 19 Jan 2002 08:27:47 +0000 (08:27 +0000)
(wl-message-buffer-prefetch-idle-time): Moved from `wl-message.el'
* wl-message.el (wl-message-buffer-prefetch-next): Rewrite.
(wl-message-buffer-prefetch): Rewrite.
(wl-message-buffer-prefetch-idle-time): Removed.
* wl-summary.el (wl-summary-redisplay-internal):
Prepare prefetch with `wl-message-buffer-prefetch-depth'.
Error check for `wl-message-buffer-prefetch-depht'.

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

index 955b82d..5ed2e3f 100644 (file)
@@ -2701,6 +2701,16 @@ IMAP \e$B$N%a%C%;!<%8$@$1$,@hFI$_$5$l$^$9!#$3$NJQ?t$O\e(B
 \e$B@hFI$_5!G=$rM-8z$K$9$k%U%)%k%@$r%U%)%k%@L>\e(B(\e$B@55,I=8=\e(B)\e$B$N%j%9%H$G;XDj$7$^$9!#\e(B
 @end table
 
+@table @code
+@item wl-message-buffer-prefetch-depth
+@vindex wl-message-buffer-prefetch-depth
+\e$B=i4|@_Dj$O\e(B 5\e$B!#@hFI$_5!G=$9$k%a%C%;!<%8$N?t!#\e(B
+
+@table @code
+@item wl-message-buffer-prefetch-idle-time
+@vindex wl-message-buffer-prefetch-idle-time
+\e$B=i4|@_Dj$O\e(B 0.2 (\e$BC10L\e(B:\e$BIC\e(B)\e$B!#@hFI$_5!G=$9$k;~4V4V3V!#\e(B
+
 
 @node Auto Refile, Sticky Summary, Cache, Summary
 @section \e$B<+F0%j%U%!%$%k\e(B
index 0ffc6e0..7aaa29a 100644 (file)
@@ -2707,6 +2707,16 @@ The initial setting is @code{nil}.
 A list of regexp of folders to enable message prefetching.
 @end table
 
+@table @code
+@item wl-message-buffer-prefetch-depth
+@vindex wl-message-buffer-prefetch-depth
+The initial settionf is 5. The number of prefetching messages.
+
+@table @code
+@item wl-message-buffer-prefetch-idle-time
+@vindex wl-message-buffer-prefetch-idle-time
+The initial settionf is 0.2 (in seconds). The period of prefetching.
+
 
 @node Auto Refile, Sticky Summary, Cache, Summary
 @section Auto Refile
index 24c6210..ec7c775 100644 (file)
@@ -1,5 +1,16 @@
 2002-01-19  Kenichi OKADA  <okada@opaopa.org>
 
+       * wl-vars.el (wl-message-buffer-prefetch-depth): New variable.
+       (wl-message-buffer-prefetch-idle-time): Moved from `wl-message.el'
+       * wl-message.el (wl-message-buffer-prefetch-next): Rewrite.
+       (wl-message-buffer-prefetch): Rewrite.
+       (wl-message-buffer-prefetch-idle-time): Removed.
+       * wl-summary.el (wl-summary-redisplay-internal):
+       Prepare prefetch with `wl-message-buffer-prefetch-depth'.
+       Error check for `wl-message-buffer-prefetch-depht'.
+
+2002-01-19  Kenichi OKADA  <okada@opaopa.org>
+
        * Version number is increased to 2.9.5.
        * wl-summary.el (wl-summary-prefetch-msg): Fix for buffer-cache.
 
index c9dbb63..26e1f51 100644 (file)
   (defalias-maybe 'event-start 'ignore)
   (defalias-maybe 'mime-open-entity 'ignore))
 
-(defconst wl-message-buffer-prefetch-idle-time
-  (if (featurep 'lisp-float-type) (/ (float 1) (float 5)) 1))
 (defvar wl-message-buffer-prefetch-get-next-function
   'wl-summary-default-get-next-msg)
 
 (defvar wl-message-buffer-prefetch-debug nil)
+(defvar wl-message-buffer-prefetch-timer nil)
 
 (defvar wl-message-buffer nil) ; message buffer.
 
@@ -549,9 +548,7 @@ Returns non-nil if bottom of message."
                                wl-message-buffer-prefetch-folder-list))
        (t wl-message-buffer-prefetch-folder-list))))
 
-(defvar wl-message-buffer-prefetch-timer nil)
-
-(defun wl-message-buffer-prefetch-next (folder number &optional
+(defun wl-message-buffer-prefetch-next (folder number count &optional
                                               summary charset)
   (if (wl-message-buffer-prefetch-p folder)
       (with-current-buffer (or summary (get-buffer wl-summary-buffer-name))
@@ -560,49 +557,63 @@ Returns non-nil if bottom of message."
          (when (and next (wl-message-buffer-prefetch-p folder next))
            (if (not (fboundp 'run-with-idle-timer))
                (when (sit-for wl-message-buffer-prefetch-idle-time)
-                 (wl-message-buffer-prefetch folder next summary charset))
+                 (wl-message-buffer-prefetch
+                  folder next count summary charset))
              (unless wl-message-buffer-prefetch-timer
                (setq wl-message-buffer-prefetch-timer
                      (run-with-idle-timer
                       wl-message-buffer-prefetch-idle-time
                       nil
                       'wl-message-buffer-prefetch
-                      folder next summary charset)))))))))
-
-(defun wl-message-buffer-prefetch (folder number summary charset)
-  (when (buffer-live-p summary)
-    (save-excursion
-      (set-buffer summary)
-      (when (string= (elmo-folder-name-internal folder)
-                    (wl-summary-buffer-folder-name))
-       (let ((message-id (elmo-message-field folder number 'message-id))
-             (wl-mime-charset      charset)
-             (default-mime-charset charset)
-             result time1 time2 sec micro)
-         (if (not (wl-message-buffer-cache-hit (list folder
-                                                     number message-id)))
-             (let* ((size (elmo-message-field folder number 'size)))
-               (when (or (elmo-message-file-p folder number)
-                         (not
-                          (and (integerp size)
-                               elmo-message-fetch-threshold
-                               (>= size
-                                   elmo-message-fetch-threshold))))
-                 ;;(not (elmo-file-cache-exists-p message-id)))))
-                 (when wl-message-buffer-prefetch-debug
-                   (setq time1 (current-time))
-                   (message "Prefetching %d..." number))
-                 (setq result (wl-message-buffer-display folder number
-                                                         'mime nil 'unread))
-                 (when wl-message-buffer-prefetch-debug
-                   (setq time2 (current-time))
-                   (setq sec  (- (nth 1 time2)(nth 1 time1)))
-                   (setq micro (- (nth 2 time2)(nth 2 time1)))
-                   (setq micro (+ micro (* 1000000 sec)))
-                   (message "Prefetching %d...done(%f msec)."
-                            number
-                            (/ micro 1000.0))))))))))
-  (setq wl-message-buffer-prefetch-timer nil))
+                      folder next count summary charset)))))))))
+
+(defun wl-message-buffer-prefetch (folder number count summary charset)
+  (setq wl-message-buffer-prefetch-timer nil)
+  (if (and (numberp count)
+          (>= (setq count (- count 1)) 0))
+      (if (buffer-live-p summary)
+         (save-excursion
+           (set-buffer summary)
+           (if (string= (elmo-folder-name-internal folder)
+                        (wl-summary-buffer-folder-name))
+               (let* ((message-id (elmo-message-field folder number 'message-id))
+                      (wl-mime-charset      charset)
+                      (default-mime-charset charset)
+                      (key (list (elmo-folder-name-internal folder)
+                                 number message-id))
+                      (hit (wl-message-buffer-cache-hit key))
+                      result time1 time2 sec micro)
+                 (if (and hit (buffer-live-p hit))
+                     (wl-message-buffer-cache-sort
+                      (wl-message-buffer-cache-entry-make key hit))
+                   (let* ((size (elmo-message-field folder number 'size)))
+                     (when (or (elmo-message-file-p folder number)
+                               (not
+                                (and (integerp size)
+                                     elmo-message-fetch-threshold
+                                     (>= size
+                                         elmo-message-fetch-threshold))))
+                       ;;(not (elmo-file-cache-exists-p message-id)))))
+                       (when wl-message-buffer-prefetch-debug
+                         (setq time1 (current-time))
+                         (message "Prefetching %d..." number))
+                       (setq result (wl-message-buffer-display folder number
+                                                               'mime nil 'unread))
+                       (when wl-message-buffer-prefetch-debug
+                         (setq time2 (current-time))
+                         (setq sec  (- (nth 1 time2)(nth 1 time1)))
+                         (setq micro (- (nth 2 time2)(nth 2 time1)))
+                         (setq micro (+ micro (* 1000000 sec)))
+                         (message "Prefetching %d...done(%f msec)."
+                                  number
+                                  (/ micro 1000.0))))))
+                 (wl-message-buffer-prefetch-next
+                  folder number count summary charset)))))
+    (when wl-message-buffer-prefetch-debug
+      (message "Buffer Cached Messages %S"
+              (mapcar '(lambda (cache)
+                         (nth 1 (car cache)))
+                      wl-message-buffer-cache)))))
 
 (defvar wl-message-button-map (make-sparse-keymap))
 
index 7d8b0e7..645d932 100644 (file)
@@ -5216,8 +5216,16 @@ Use function list is `wl-summary-write-current-folder-functions'."
            (if (not wl-summary-indent-length-limit)
                (wl-horizontal-recenter)))
          (wl-highlight-summary-displaying)
-         (wl-message-buffer-prefetch-next folder num (current-buffer)
-                                          wl-summary-buffer-mime-charset)
+         (when wl-message-buffer-prefetch-depth
+           (if (not (< wl-message-buffer-prefetch-depth
+                       wl-message-buffer-cache-size))
+               (error (concat
+                       "`wl-message-buffer-prefetch-depth' must be smaller than "
+                       "`wl-message-buffer-cache-size' - 1.")))
+           (wl-message-buffer-prefetch-next folder num
+                                            wl-message-buffer-prefetch-depth
+                                            (current-buffer)
+                                            wl-summary-buffer-mime-charset))
          (run-hooks 'wl-summary-redisplay-hook))
       (message "No message to display."))))
 
index 925fd34..fde78a9 100644 (file)
@@ -1695,6 +1695,16 @@ e.x.
   :type '(repeat (regexp :tag "Folder Regexp"))
   :group 'wl-pref)
 
+(defcustom wl-message-buffer-prefetch-depth 5
+  "*Depth of buffer prefetch in summary mode."
+  :type 'integer
+  :group 'wl-pref)
+
+(defcustom wl-message-buffer-prefetch-idle-time 0.2
+  "*Idle time of buffer prefetch."
+  :type 'number
+  :group 'wl-pref)
+
 (defcustom wl-summary-always-sticky-folder-list nil
   "All folders that match this list has sticky summary.
 Each elements are regexp of folder name."