From: okada Date: Sat, 19 Jan 2002 08:27:47 +0000 (+0000) Subject: * wl-vars.el (wl-message-buffer-prefetch-depth): New variable. X-Git-Tag: wl-2_9_6~47 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0cb4bf32414cc9785172bd0a7324dfc573fe0158;p=elisp%2Fwanderlust.git * 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'. --- diff --git a/doc/wl-ja.texi b/doc/wl-ja.texi index 955b82d..5ed2e3f 100644 --- a/doc/wl-ja.texi +++ b/doc/wl-ja.texi @@ -2701,6 +2701,16 @@ IMAP のメッセージだけが先読みされます。この変数は 先読み機能を有効にするフォルダをフォルダ名(正規表現)のリストで指定します。 @end table +@table @code +@item wl-message-buffer-prefetch-depth +@vindex wl-message-buffer-prefetch-depth +初期設定は 5。先読み機能するメッセージの数。 + +@table @code +@item wl-message-buffer-prefetch-idle-time +@vindex wl-message-buffer-prefetch-idle-time +初期設定は 0.2 (単位:秒)。先読み機能する時間間隔。 + @node Auto Refile, Sticky Summary, Cache, Summary @section 自動リファイル diff --git a/doc/wl.texi b/doc/wl.texi index 0ffc6e0..7aaa29a 100644 --- a/doc/wl.texi +++ b/doc/wl.texi @@ -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 diff --git a/wl/ChangeLog b/wl/ChangeLog index 24c6210..ec7c775 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,5 +1,16 @@ 2002-01-19 Kenichi OKADA + * 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 + * Version number is increased to 2.9.5. * wl-summary.el (wl-summary-prefetch-msg): Fix for buffer-cache. diff --git a/wl/wl-message.el b/wl/wl-message.el index c9dbb63..26e1f51 100644 --- a/wl/wl-message.el +++ b/wl/wl-message.el @@ -42,12 +42,11 @@ (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)) diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 7d8b0e7..645d932 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -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.")))) diff --git a/wl/wl-vars.el b/wl/wl-vars.el index 925fd34..fde78a9 100644 --- a/wl/wl-vars.el +++ b/wl/wl-vars.el @@ -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."