From e09545d6c8d37dc801e380796363cbe111614b42 Mon Sep 17 00:00:00 2001 From: teranisi Date: Wed, 21 Aug 2002 23:40:56 +0000 Subject: [PATCH] * wl-vars.el (wl-message-buffer-name): New user option. * wl-summary.el (wl-summary-read-folder): Use wl-folder-entity-hashtb directly instead of making alist dinamically. * wl-message.el (wl-message-buffer-cache-name): Abolish. (wl-message-buffer-create): Use wl-message-buffer-name instead of wl-message-buffer-cache-name. (wl-message-buffer-cache-clean-up): Ditto. * wl-folder.el (wl-folder-set-entity-info): Use elmo-string. * elmo-util.el (elmo-warning): Define as a macro which uses `display-warning' if it is defined as a function. * elmo-split.el (elmo-split-fetch-decoded-field): New function. (elmo-split-equal): Use it. (elmo-split-match): Ditto. (elmo-split-message-entity): New buffer-local variable. (elmo-split-subr): Set it. --- elmo/ChangeLog | 9 +++++++++ elmo/elmo-split.el | 22 ++++++++++++++++++++-- elmo/elmo-util.el | 27 +++++++++++++++------------ wl/ChangeLog | 12 ++++++++++++ wl/wl-e21.el | 4 ++-- wl/wl-folder.el | 2 +- wl/wl-message.el | 5 ++--- wl/wl-summary.el | 9 +-------- wl/wl-vars.el | 5 +++++ 9 files changed, 67 insertions(+), 28 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index e28418a..b1c93e6 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,14 @@ 2002-08-21 Yuuichi Teranishi + * elmo-util.el (elmo-warning): Define as a macro which uses + `display-warning' if it is defined as a function. + + * elmo-split.el (elmo-split-fetch-decoded-field): New function. + (elmo-split-equal): Use it. + (elmo-split-match): Ditto. + (elmo-split-message-entity): New buffer-local variable. + (elmo-split-subr): Set it. + * elmo-version.el (elmo-version): Up to 2.9.15. 2002-08-18 Kenichi OKADA diff --git a/elmo/elmo-split.el b/elmo/elmo-split.el index a8d9157..1038818 100644 --- a/elmo/elmo-split.el +++ b/elmo/elmo-split.el @@ -119,6 +119,10 @@ Example: (defvar elmo-split-match-string-internal nil "Internal variable for string matching. Don't touch this variable by hand.") +(defvar elmo-split-message-entity nil + "Buffer local variable to store mime-entity.") +(make-variable-buffer-local 'elmo-split-message-entity) + ;;; (defun elmo-split-or (buffer &rest args) (catch 'done @@ -166,14 +170,27 @@ Example: (setq addrs (cdr addrs))) result))) +(defun elmo-split-fetch-decoded-field (entity field-name) + (let ((sym (intern (capitalize field-name))) + (field-body (mime-entity-fetch-field entity field-name))) + (when field-body + (mime-decode-field-body field-body sym 'plain)))) + (defun elmo-split-equal (buffer field value) (with-current-buffer buffer - (let ((field-value (std11-field-body (symbol-name field)))) + (let ((field-value (and + elmo-split-message-entity + (elmo-split-fetch-decoded-field + elmo-split-message-entity + (symbol-name field))))) (equal field-value value)))) (defun elmo-split-match (buffer field value) (with-current-buffer buffer - (let ((field-value (std11-field-body (symbol-name field)))) + (let ((field-value (and elmo-split-message-entity + (elmo-split-fetch-decoded-field + elmo-split-message-entity + (symbol-name field))))) (and field-value (when (string-match value field-value) (setq elmo-split-match-string-internal field-value)))))) @@ -249,6 +266,7 @@ If prefix argument ARG is specified, do a reharsal (no harm)." (elmo-message-fetch folder msg (elmo-make-fetch-strategy 'entire) nil (current-buffer) 'unread)) + (setq elmo-split-message-entity (mime-parse-buffer)) (catch 'terminate (dolist (rule elmo-split-rule) (setq elmo-split-match-string-internal nil) diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index f8f3bf1..49326f0 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -1878,15 +1878,18 @@ If KBYTES is kilo bytes (This value must be float)." ;;; ;; Warnings. -(defconst elmo-warning-buffer-name "*elmo warning*") - -(defun elmo-warning (&rest args) - "Display a warning, making warning message by passing all args to `insert'." - (with-current-buffer (get-buffer-create elmo-warning-buffer-name) - (goto-char (point-max)) - (apply 'insert (append args '("\n"))) - (ignore-errors (recenter 1)) - (display-buffer elmo-warning-buffer-name))) +(static-if (fboundp 'display-warning) + (defmacro elmo-warning (&rest args) + "Display a warning with `elmo' group." + `(display-warning 'elmo (format ,@args))) + (defconst elmo-warning-buffer-name "*elmo warning*") + (defun elmo-warning (&rest args) + "Display a warning. ARGS are passed to `format'." + (with-current-buffer (get-buffer-create elmo-warning-buffer-name) + (goto-char (point-max)) + (funcall 'insert (apply 'format (append args '("\n")))) + (ignore-errors (recenter 1)) + (display-buffer elmo-warning-buffer-name)))) (defvar elmo-obsolete-variable-alist nil) @@ -1916,9 +1919,9 @@ If `elmo-obsolete-variable-show-warnings' is non-nil, show warning message." (defvaralias var obsolete) (set var (symbol-value obsolete))) (if elmo-obsolete-variable-show-warnings - (elmo-warning (format "%s is obsolete. Use %s instead." - (symbol-name obsolete) - (symbol-name var)))))) + (elmo-warning "%s is obsolete. Use %s instead." + (symbol-name obsolete) + (symbol-name var))))) (defun elmo-resque-obsolete-variables (&optional alist) "Resque obsolete variables in ALIST. diff --git a/wl/ChangeLog b/wl/ChangeLog index a6a084a..aa1064f 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,5 +1,17 @@ 2002-08-21 Yuuichi Teranishi + * wl-vars.el (wl-message-buffer-name): New user option. + + * wl-summary.el (wl-summary-read-folder): Use wl-folder-entity-hashtb + directly instead of making alist dinamically. + + * wl-message.el (wl-message-buffer-cache-name): Abolish. + (wl-message-buffer-create): Use wl-message-buffer-name instead of + wl-message-buffer-cache-name. + (wl-message-buffer-cache-clean-up): Ditto. + + * wl-folder.el (wl-folder-set-entity-info): Use elmo-string. + * Version number is increased to 2.9.15. 2002-08-06 Yuuichi Teranishi diff --git a/wl/wl-e21.el b/wl/wl-e21.el index a38ef75..bd8c203 100644 --- a/wl/wl-e21.el +++ b/wl/wl-e21.el @@ -542,7 +542,7 @@ (defun wl-message-wheel-up (event) (interactive "e") - (if (string-match (regexp-quote wl-message-buffer-cache-name) + (if (string-match (regexp-quote wl-message-buffer-name) (regexp-quote (buffer-name))) (wl-message-next-page) (let ((cur-buf (current-buffer)) @@ -558,7 +558,7 @@ (defun wl-message-wheel-down (event) (interactive "e") - (if (string-match (regexp-quote wl-message-buffer-cache-name) + (if (string-match (regexp-quote wl-message-buffer-name) (regexp-quote (buffer-name))) (wl-message-prev-page) (let ((cur-buf (current-buffer)) diff --git a/wl/wl-folder.el b/wl/wl-folder.el index d99faa7..bc833d0 100644 --- a/wl/wl-folder.el +++ b/wl/wl-folder.el @@ -293,7 +293,7 @@ (defmacro wl-folder-set-entity-info (entity value &optional hashtb) (` (let* ((hashtb (or (, hashtb) wl-folder-entity-hashtb)) (info (wl-folder-get-entity-info (, entity) hashtb))) - (elmo-set-hash-val (, entity) + (elmo-set-hash-val (elmo-string (, entity)) (if (< (length (, value)) 4) (append (, value) (list (nth 3 info))) (, value)) diff --git a/wl/wl-message.el b/wl/wl-message.el index 856c6a7..96edf90 100644 --- a/wl/wl-message.el +++ b/wl/wl-message.el @@ -109,7 +109,6 @@ With association ((\"folder\" message \"message-id\") . cache-buffer).") ; (setcdr pointer (list entry)) ; (setq wl-message-buffer-cache (cdr top)))) -(defconst wl-message-buffer-cache-name " *WL:Message*") (defconst wl-original-message-buffer-name " *Original*") (defun wl-original-message-mode () @@ -131,7 +130,7 @@ If original message buffer already exists, it is re-used." (defun wl-message-buffer-create () "Create a new message buffer." - (let* ((buffer (generate-new-buffer wl-message-buffer-cache-name)) + (let* ((buffer (generate-new-buffer wl-message-buffer-name)) (name (buffer-name buffer))) (with-current-buffer buffer (setq wl-message-buffer-original-buffer @@ -173,7 +172,7 @@ Return its cache buffer." wl-message-buffer (get-buffer-window wl-message-buffer)) (delete-window (get-buffer-window wl-message-buffer))) - (wl-kill-buffers (regexp-quote wl-message-buffer-cache-name)) + (wl-kill-buffers (regexp-quote wl-message-buffer-name)) (setq wl-message-buffer-cache nil)) ;;; Message buffer handling from summary buffer. diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 421ed04..8c27278 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -3127,14 +3127,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER." (or wl-folder-completion-function (if (memq 'read-folder wl-use-folder-petname) (wl-folder-get-entity-with-petname) - (let (alist) - (mapatoms - (lambda (atom) - (setq alist - (cons (list (elmo-string - (symbol-name atom))) alist))) - wl-folder-entity-hashtb) - alist))) + wl-folder-entity-hashtb)) nil nil (or init wl-default-spec) 'wl-read-folder-hist))) (if (or (string= fld wl-default-spec) diff --git a/wl/wl-vars.el b/wl/wl-vars.el index 35c84fd..f08e35f 100644 --- a/wl/wl-vars.el +++ b/wl/wl-vars.el @@ -1879,6 +1879,11 @@ See also variable `wl-summary-next-no-unread-command'." :group 'wl-pref :group 'wl-setting) +(defcustom wl-message-buffer-name " *WL:Message*" + "*Buffer name for message buffers." + :group 'wl-pref + :group 'wl-setting) + (defcustom wl-message-buffer-prefetch-folder-type-list t "*All folder types that match this list prefetch next message, and reserved buffer cache." -- 1.7.10.4