[mew-dist 27447] Re: Hyperestraier
Tatsuya Kinoshita
tats at example.com
2006年 10月 26日 (木) 23:12:12 JST
On October 26, 2006, [mew-dist 27446],
kasahara (at nc.kyushu-u.ac.jp) wrote:
> > mew-search-est の最初の方で (mew-pick-parse (mew-pick-lex filter)) を通っ
> > た時点で and が追加されていて、それが mew-pick-filter-est-kyvl ではじか
> > れていました。& や | を書いた場合も同様です。
>
> そもそも mew-pick-parse は mewl/grep 用なので、
> mew-pick-canonicalize-pattern-est をどこかで呼ばないといけないんだと思
> うんですが、
mew-pick-canonicalize-pattern-estはキーワード用で、field=valueを拒否
するようになっています。フィルタ用にはmew-pick-parseを流用して済ませ
ているということでしょう。
さて、複数条件など、est検索での当面の問題を回避するためのパッチを作っ
てみました。"|"対応は難しいので、"to,cc=mew-dist"という形式を許容す
るようにしています。
* 複数条件、"&"対応("|", "!", 括弧は不可)
* 複数フィールドを許容(to,cc=mew-dist)
* キーワード空入力を許容(スペースとみなして続行)
----
--- mew.orig/mew-pick.el
+++ mew/mew-pick.el
@@ -655,6 +655,11 @@
(defvar mew-pick-filter-est-head-fields "date,subject,from,to,cc,resent-from,resent-to,resent-cc,reply-to,mail-followup-to,x-mail-count,x-ml-count,x-ml-name,x-seqno,x-sequence,mailinglist-id,message-id,in-reply-to,references,newsgroups,followup-to")
(defun mew-pick-filter-est-kyvl (kyvl)
+ (when (and (stringp kyvl)
+ (string-match "^\\([-a-z0-9,]+\\)\\(!?==?\\)\\(.+\\)$" kyvl))
+ (setq kyvl (list (mew-match-string 2 kyvl)
+ (mew-match-string 1 kyvl)
+ (mew-match-string 3 kyvl))))
(unless (and (listp kyvl) (= (length kyvl) 3))
(error "Filter is invalid" kyvl))
(let ((op (nth 0 kyvl))
--- mew.orig/mew-search.el
+++ mew/mew-search.el
@@ -130,13 +130,13 @@
(message "This command cannot be used")
(setq pattern (mew-input-pick-pattern (concat name " pick")))
(if (string= pattern "")
- (message (mew-substitute-for-summary "Keyword must be specified. You may use '\\[mew-summary-pick]' instead"))
- (when (and canon-func (fboundp canon-func))
- (setq pattern (funcall canon-func pattern)))
- (if (fboundp flt-func)
- (setq filter (funcall flt-func)))
- (setq msgs (funcall func pattern folder filter))
- (mew-summary-pick-ls folder msgs)))))))
+ (setq pattern " "))
+ (when (and canon-func (fboundp canon-func))
+ (setq pattern (funcall canon-func pattern)))
+ (if (fboundp flt-func)
+ (setq filter (funcall flt-func)))
+ (setq msgs (funcall func pattern folder filter))
+ (mew-summary-pick-ls folder msgs))))))
(defun mew-summary-search-virtual (&optional ask-folder)
"Making Virtual mode according to a specified pick pattern
@@ -156,29 +156,29 @@
(setq flds (mew-input-folders (mew-summary-folder-name))))
(setq opattern (mew-input-pick-pattern (concat name " virtual")))
(if (string= opattern "")
- (message (mew-substitute-for-summary "Keyword must be specified"))
- (if (and canon-func (fboundp canon-func))
- (setq pattern (funcall canon-func opattern))
- (setq pattern opattern))
- (if (fboundp flt-func)
- (setq filter (funcall flt-func)))
- (setq vfolder (mew-folder-to-virtual opattern))
- (mew-summary-switch-to-folder vfolder)
- (mew-sinfo-set-find-key opattern)
- (make-local-variable 'mew-summary-form-mark-delete)
- (setq mew-summary-form-mark-delete nil)
- (make-local-variable 'mew-summary-form-mark-spam)
- (setq mew-summary-form-mark-spam nil)
- (when (mew-summary-exclusive-p)
- (with-temp-buffer
- (mew-set-buffer-multibyte t)
- (mew-piolet
- mew-cs-text-for-read mew-cs-text-for-write
- (setq file-rttl (funcall func pattern flds filter)))))
- (mew-set '(file rttl) file-rttl)
- (setq dfunc `(lambda () (mew-delete-file ,file)))
- (setq opts (list "-i" file))
- (mew-local-retrieve 'vir opts dfunc nil nil rttl))))))
+ (setq opattern " "))
+ (if (and canon-func (fboundp canon-func))
+ (setq pattern (funcall canon-func opattern))
+ (setq pattern opattern))
+ (if (fboundp flt-func)
+ (setq filter (funcall flt-func)))
+ (setq vfolder (mew-folder-to-virtual opattern))
+ (mew-summary-switch-to-folder vfolder)
+ (mew-sinfo-set-find-key opattern)
+ (make-local-variable 'mew-summary-form-mark-delete)
+ (setq mew-summary-form-mark-delete nil)
+ (make-local-variable 'mew-summary-form-mark-spam)
+ (setq mew-summary-form-mark-spam nil)
+ (when (mew-summary-exclusive-p)
+ (with-temp-buffer
+ (mew-set-buffer-multibyte t)
+ (mew-piolet
+ mew-cs-text-for-read mew-cs-text-for-write
+ (setq file-rttl (funcall func pattern flds filter)))))
+ (mew-set '(file rttl) file-rttl)
+ (setq dfunc `(lambda () (mew-delete-file ,file)))
+ (setq opts (list "-i" file))
+ (mew-local-retrieve 'vir opts dfunc nil nil rttl)))))
(defun mew-summary-make-index-folder ()
"Make index for this folder."
@@ -541,7 +541,7 @@
(if (string= filter "")
(setq filter nil)
(setq filter (mew-cs-encode-string filter 'utf-8))
- (setq filter (mew-pick-parse (mew-pick-lex filter)))
+ (setq filter (delete 'and (mew-pick-parse (mew-pick-lex filter))))
(setq filter (mapcar 'mew-pick-filter-est-kyvl filter)))
(let* ((ent (mew-search-get-ent mew-search-method))
(prog (mew-search-get-prog ent))
----
--
木下達也
Mew-dist メーリングリストの案内