[mew-dist 22061] Re: folder search

Kazu Yamamoto ( 山本和彦 ) kazu at example.com
2002年 10月 28日 (月) 15:18:35 JST


From: Kazu Yamamoto (山本和彦) <kazu at example.com>
Subject: [mew-dist 22059] Re: folder search

> 代案としては、
> 	(a) alist はソートされた状態で保持 (金曜日のパッチを当た状態)
> 		→ folder search は OK
> 	(b) refile の際に、検索を工夫する
> 		→ "foo$" と "foo/$" で 2 回検索するのではなく、
> 		   1 回リストをなめるだけでよいように工夫。
> の方がよいと思います。

とりあえず、作ってみました。使ってみて下さい。一回だけ、"1Z" して下さ
いね。

--かず

Index: mew-func.el
===================================================================
RCS file: /cvsroot/mew/mew/mew-func.el,v
retrieving revision 1.98
diff -c -r1.98 mew-func.el
*** mew-func.el	2002/10/10 11:24:45	1.98
--- mew-func.el	2002/10/28 06:18:17
***************
*** 159,164 ****
--- 159,179 ----
  	    (throw 'loop a))
  	(setq alist (cdr alist))))))
  
+ (defun mew-assoc-folder (key alist)
+   (let ((skey (downcase key))
+ 	(regex (concat mew-path-separator "$"))
+ 	a n ret)
+     (catch 'loop
+       (while alist
+ 	(setq a (car alist))
+ 	(setq n (nth 1 a))
+ 	(when (and (stringp n) (string= (downcase n) skey))
+ 	  (setq ret a)
+ 	  (unless (string-match regex (car a))
+ 	    (throw 'loop nil)))
+ 	(setq alist (cdr alist))))
+     ret))
+ 
  (defun mew-assoc-match (key alist nth)
    "Return list in ALIST that KEY regex is matched to its NTH element.
  Case is ignored. Note that the NTH element is 't', 
Index: mew-local.el
===================================================================
RCS file: /cvsroot/mew/mew/mew-local.el,v
retrieving revision 1.51
diff -c -r1.51 mew-local.el
*** mew-local.el	2002/10/24 08:15:03	1.51
--- mew-local.el	2002/10/28 06:18:17
***************
*** 100,107 ****
  	  (setq ret (cons (mew-local-folder-entry ent nil make-list) ret))
  	  (setq dirs (cdr dirs))) ;; skip subfolder
  	 (t
- 	  (setq ret (nconc (mew-local-folder-make-alist (car dirs) ent make-list) ret))
  	  (setq ret (cons (mew-local-folder-entry (file-name-as-directory ent) dir make-list) ret))
  	  (setq dirs (cdr dirs)))))
         (t
  	(if (string-match mew-regex-ignore-folders ent)
--- 100,107 ----
  	  (setq ret (cons (mew-local-folder-entry ent nil make-list) ret))
  	  (setq dirs (cdr dirs))) ;; skip subfolder
  	 (t
  	  (setq ret (cons (mew-local-folder-entry (file-name-as-directory ent) dir make-list) ret))
+ 	  (setq ret (nconc (mew-local-folder-make-alist (car dirs) ent make-list) ret))
  	  (setq dirs (cdr dirs)))))
         (t
  	(if (string-match mew-regex-ignore-folders ent)
Index: mew-refile.el
===================================================================
RCS file: /cvsroot/mew/mew/mew-refile.el,v
retrieving revision 1.59
diff -c -r1.59 mew-refile.el
*** mew-refile.el	2002/10/15 07:35:40	1.59
--- mew-refile.el	2002/10/28 06:18:17
***************
*** 137,144 ****
        (setq ml-addr (mew-addrstr-parse-address (or (car to-cc) "")))
        (when ml-addr
  	(setq ml-name (mew-addrstr-extract-user ml-addr))
! 	(setq ent (or (mew-assoc-case-equal ml-addr alist 1)
! 		      (mew-assoc-case-equal ml-name alist 1)))
  	(mew-addq ret (nth 0 ent)))
        (setq to-cc (cdr to-cc)))
      (nreverse ret)))
--- 137,144 ----
        (setq ml-addr (mew-addrstr-parse-address (or (car to-cc) "")))
        (when ml-addr
  	(setq ml-name (mew-addrstr-extract-user ml-addr))
! 	(setq ent (or (mew-assoc-folder ml-addr alist)
! 		      (mew-assoc-folder ml-name alist)))
  	(mew-addq ret (nth 0 ent)))
        (setq to-cc (cdr to-cc)))
      (nreverse ret)))



Mew-dist メーリングリストの案内