From 1785d67474f2bb8609c7e15d08f749fb5fb61892 Mon Sep 17 00:00:00 2001 From: teranisi Date: Tue, 3 Oct 2000 10:26:10 +0000 Subject: [PATCH] * wl-summary.el (wl-summary-pick): Rewrite. --- wl/ChangeLog | 2 +- wl/wl-summary.el | 102 +++++++++--------------------------------------------- 2 files changed, 18 insertions(+), 86 deletions(-) diff --git a/wl/ChangeLog b/wl/ChangeLog index 8ba839d..50a70ab 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,6 +1,6 @@ 2000-10-03 Yuuichi Teranishi - * wl-summary.el (wl-summary-pick): Fixed. + * wl-summary.el (wl-summary-pick): Rewrite. * wl-draft.el (wl-draft-forward): Get references field from original buffer. diff --git a/wl/wl-summary.el b/wl/wl-summary.el index cd6ace4..6477b3b 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -3864,91 +3864,23 @@ If optional argument NUMBER is specified, mark message specified by NUMBER." (defun wl-summary-pick (&optional from-list delete-marks) (interactive) - (save-excursion - (let* ((completion-ignore-case t) - (field (completing-read - (format "Field name (%s): " wl-summary-pick-field-default) - (mapcar 'list - (append '("From" "Subject" "Date" - "To" "Cc" "Body" "Since" "Before") - elmo-msgdb-extra-fields)))) - (field (if (string= field "") - (setq field wl-summary-pick-field-default) - field)) - (value (if (string-match field "Since\\|Before") - (completing-read "Value: " - (mapcar (function - (lambda (x) - (list (format "%s" (car x))))) - elmo-date-descriptions)) - (read-from-minibuffer "Value: "))) - (overview (elmo-msgdb-get-overview wl-summary-buffer-msgdb)) - (number-alist (elmo-msgdb-get-number-alist wl-summary-buffer-msgdb)) - server-side-search - result get-func sum) - (if delete-marks - (let ((mlist wl-summary-buffer-target-mark-list)) - (while mlist - (when (wl-summary-jump-to-msg (car mlist)) - (wl-summary-unmark)) - (setq mlist (cdr mlist))) - (setq wl-summary-buffer-target-mark-list nil))) - (setq field (downcase field)) - (cond - ((string-match field "from") - (setq get-func 'elmo-msgdb-overview-entity-get-from)) - ((string-match field "subject") - (setq get-func 'elmo-msgdb-overview-entity-get-subject)) - ((string-match field "date") - (setq get-func 'elmo-msgdb-overview-entity-get-date)) - ((string-match field "to") - (setq get-func 'elmo-msgdb-overview-entity-get-to)) - ((string-match field "cc") - (setq get-func 'elmo-msgdb-overview-entity-get-cc)) - ((string-match field "since") - (setq server-side-search (vector 'match "since" value))) - ((string-match field "before") - (setq server-side-search (vector 'match "before" value))) - ((string-match field "body") - (setq server-side-search (vector 'match "body" value))) - ((member field elmo-msgdb-extra-fields) - (setq get-func - (lambda (entity) - (elmo-msgdb-overview-entity-get-extra-field entity field)))) - (t - (error "Pick by %s is not supported" field))) - (unwind-protect - (if server-side-search - (progn - (message "Searching...") - (let ((elmo-mime-charset wl-summary-buffer-mime-charset)) - (setq result (elmo-search wl-summary-buffer-folder-name - server-side-search))) - (if from-list - (setq result (elmo-list-filter from-list result))) - (message "%d message(s) are picked." (length result))) - (setq sum 0) - (message "Searching...") - (while overview - (when (and (string-match value - (or - (funcall get-func (car overview)) - "")) - (or (not from-list) - (memq - (elmo-msgdb-overview-entity-get-number - (car overview)) from-list))) - (setq result - (append result - (list - (elmo-msgdb-overview-entity-get-number - (car overview))))) - (message "Picked %d message(s)." (setq sum (+ sum 1)))) - (setq overview (cdr overview))) - (message "%d message(s) are picked." sum)) - (if (null result) - (message "No message was picked.") - (wl-summary-target-mark-msgs result)))))) + (let ((result (elmo-msgdb-search + wl-summary-buffer-folder-name + (elmo-read-search-condition wl-summary-pick-field-default) + wl-summary-buffer-msgdb))) + (if delete-marks + (let ((mlist wl-summary-buffer-target-mark-list)) + (while mlist + (when (wl-summary-jump-to-msg (car mlist)) + (wl-summary-unmark)) + (setq mlist (cdr mlist))) + (setq wl-summary-buffer-target-mark-list nil))) + (if from-list + (setq result (elmo-list-filter from-list result))) + (message "%d message(s) are picked." (length result)) + (if (null result) + (message "No message was picked.") + (wl-summary-target-mark-msgs result)))) (defun wl-summary-unvirtual () "Exit from current virtual folder." -- 1.7.10.4