From: teranisi Date: Sat, 11 May 2002 16:17:23 +0000 (+0000) Subject: * wl-vars.el (wl-summary-check-line-format): New user option. X-Git-Tag: elmo-mark-root~131 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=3d04bf62dba2d8ea8aadbfa429a6c5b31e451d88;p=elisp%2Fwanderlust.git * wl-vars.el (wl-summary-check-line-format): New user option. (wl-summary-line-format-file): Ditto. * wl-summary.el (wl-summary-buffer-line-format): New buffer local variable. (wl-summary-buffer-set-folder): Set wl-summary-buffer-line-format. (wl-summary-goto-folder-subr): Use `wl-summary-line-format-changed-p' and `wl-summary-view-old-p' to check whether do a rescan or not. (wl-summary-view-old-p): New function. (wl-summary-line-format-changed-p): Ditto. (wl-summary-line-format-save): Ditto. (wl-summary-save-view-cache): Call `wl-summary-line-format-save'. --- diff --git a/wl/ChangeLog b/wl/ChangeLog index c08e6c3..3744d3d 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,4 +1,17 @@ -2002-05-11 Yuuichi Teranishi +2002-05-11 Yuuichi Teranishi + + * wl-vars.el (wl-summary-check-line-format): New user option. + (wl-summary-line-format-file): Ditto. + + * wl-summary.el (wl-summary-buffer-line-format): New buffer local + variable. + (wl-summary-buffer-set-folder): Set wl-summary-buffer-line-format. + (wl-summary-goto-folder-subr): Use `wl-summary-line-format-changed-p' + and `wl-summary-view-old-p' to check whether do a rescan or not. + (wl-summary-view-old-p): New function. + (wl-summary-line-format-changed-p): Ditto. + (wl-summary-line-format-save): Ditto. + (wl-summary-save-view-cache): Call `wl-summary-line-format-save'. * wl-util.el (wl-set-string-width): Avoid using negative number for make-string. diff --git a/wl/wl-summary.el b/wl/wl-summary.el index c3ff1dd..2319076 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -110,6 +110,7 @@ (defvar wl-summary-buffer-msgdb nil) (defvar wl-summary-buffer-folder-name nil) (defvar wl-summary-buffer-line-formatter nil) +(defvar wl-summary-buffer-line-format nil) (defvar wl-summary-buffer-mode-line-formatter nil) (defvar wl-summary-buffer-mode-line nil) @@ -181,6 +182,7 @@ (make-variable-buffer-local 'wl-summary-buffer-msgdb) (make-variable-buffer-local 'wl-summary-buffer-folder-name) (make-variable-buffer-local 'wl-summary-buffer-line-formatter) +(make-variable-buffer-local 'wl-summary-buffer-line-format) (make-variable-buffer-local 'wl-summary-buffer-mode-line-formatter) (make-variable-buffer-local 'wl-summary-buffer-mode-line) @@ -721,7 +723,7 @@ you." (current-column)))) (setq wl-summary-buffer-temp-mark-column temp wl-summary-buffer-persistent-mark-column persistent))) - + (defun wl-summary-buffer-set-folder (folder) (if (stringp folder) (setq folder (wl-folder-get-elmo-folder folder))) @@ -746,10 +748,11 @@ you." wl-summary-default-number-column)) (wl-line-formatter-setup wl-summary-buffer-line-formatter - (or (wl-get-assoc-list-value - wl-folder-summary-line-format-alist - (elmo-folder-name-internal folder)) - wl-summary-line-format) + (setq wl-summary-buffer-line-format + (or (wl-get-assoc-list-value + wl-folder-summary-line-format-alist + (elmo-folder-name-internal folder)) + wl-summary-line-format)) wl-summary-line-format-spec-alist) (wl-line-formatter-setup wl-summary-buffer-mode-line-formatter @@ -2429,12 +2432,10 @@ If ARG, without confirm." (wl-summary-update-modeline))) (unless (eq wl-summary-buffer-view 'thread) (wl-summary-make-number-list)) - ;; XXX old summary format; do rescan. - (save-excursion - (goto-char (point-min)) - (if (and wl-summary-buffer-number-list - (not (re-search-forward "\r-?[0-9]+" (point-at-eol) t))) - (wl-summary-rescan))) + (when (or (and wl-summary-check-line-format + (wl-summary-line-format-changed-p)) + (wl-summary-view-old-p)) + (wl-summary-rescan)) (wl-summary-toggle-disp-msg (if wl-summary-buffer-disp-msg 'on 'off)) (unless (and reuse-buf keep-cursor) ;(setq hilit wl-summary-highlight) @@ -4047,6 +4048,33 @@ If ARG, exit virtual folder." ;;; Summary line. (defvar wl-summary-line-formatter nil) +(defun wl-summary-view-old-p () + "Return non-nil when summary view cache has old format." + (save-excursion + (goto-char (point-min)) + (and wl-summary-buffer-number-list + (not (re-search-forward "\r-?[0-9]+" (point-at-eol) t))))) + +(defun wl-summary-line-format-changed-p () + "Return non-nil when summary line format is changed." + (not (string= + wl-summary-buffer-line-format + (or (elmo-object-load (expand-file-name + wl-summary-line-format-file + (elmo-folder-msgdb-path + wl-summary-buffer-elmo-folder)) + wl-summary-buffer-mime-charset) + wl-summary-buffer-line-format)))) + +(defun wl-summary-line-format-save () + "Save current summary line format." + (elmo-object-save + (expand-file-name wl-summary-line-format-file + (elmo-folder-msgdb-path + wl-summary-buffer-elmo-folder)) + wl-summary-buffer-line-format + wl-summary-buffer-mime-charset)) + (defun wl-summary-line-number () (wl-set-string-width (- wl-summary-buffer-number-column) @@ -4337,6 +4365,8 @@ If ARG, exit virtual folder." (elmo-make-directory dir))) (if (eq save-view 'thread) (wl-thread-save-entity dir)) + (when wl-summary-check-line-format + (wl-summary-line-format-save)) (unwind-protect (progn (when (file-writable-p cache) diff --git a/wl/wl-vars.el b/wl/wl-vars.el index 1511e40..c8d5186 100644 --- a/wl/wl-vars.el +++ b/wl/wl-vars.el @@ -282,6 +282,18 @@ e.x. (string :tag "line format"))) :group 'wl-summary) +(defcustom wl-summary-check-line-format t + "*Check summary line format change if non-nil. +When summary line format is changed, current summary cache is discarded. +It is highly recommended to set this value to t." + :type 'boolean + :group 'wl-summary) + +(defcustom wl-summary-line-format-file ".wl-summary-line-format" + "*Cache file for summary line format." + :type 'file + :group 'wl-summary) + (defcustom wl-summary-from-function 'wl-summary-default-from "*A function for displaying sender (From: field) information." :type 'function