* wl-folder.el (wl-folder-complete-folder-candidate): New variable.
authoryoichi <yoichi>
Wed, 12 Feb 2003 00:37:49 +0000 (00:37 +0000)
committeryoichi <yoichi>
Wed, 12 Feb 2003 00:37:49 +0000 (00:37 +0000)
(wl-folder-completion-function): Abolished.
(wl-folder-complete-folder): New function.
(wl-folder-complete-filter-condition): Ditto.
* wl-summary.el (wl-summary-read-folder): Change accordingly.
* wl-fldmgr.el (wl-fldmgr-add): Ditto.

wl/ChangeLog
wl/wl-fldmgr.el
wl/wl-folder.el
wl/wl-summary.el

index 21dbdc5..0c203b6 100644 (file)
@@ -1,3 +1,12 @@
+2003-02-12  Yoichi NAKAYAMA  <yoichi@eken.phys.nagoya-u.ac.jp>
+
+       * wl-folder.el (wl-folder-complete-folder-candidate): New variable.
+       (wl-folder-completion-function): Abolished.
+       (wl-folder-complete-folder): New function.
+       (wl-folder-complete-filter-condition): Ditto.
+       * wl-summary.el (wl-summary-read-folder): Change accordingly.
+       * wl-fldmgr.el (wl-fldmgr-add): Ditto.
+
 2003-02-11  Yoichi NAKAYAMA  <yoichi@eken.phys.nagoya-u.ac.jp>
 
        * wl-draft.el (wl-draft-send-confirm): New function.
index c4aed76..699c390 100644 (file)
@@ -810,7 +810,7 @@ return value is diffs '(-new -unread -all)."
     (beginning-of-line)
     (let ((ret-val nil)
          (inhibit-read-only t)
-         (wl-folder-completion-function
+         (wl-folder-complete-folder-candidate
           (if wl-fldmgr-add-complete-with-current-folder-list
               (function wl-fldmgr-add-completion-subr)))
          tmp indent path diffs)
index 262db0d..ad8a1dd 100644 (file)
@@ -61,7 +61,6 @@
 
 (defvar wl-folder-newsgroups-hashtb nil)
 (defvar wl-folder-info-alist-modified nil)
-(defvar wl-folder-completion-function nil)
 
 (defvar wl-folder-mode-map nil)
 
@@ -2917,6 +2916,73 @@ Call `wl-summary-write-current-folder' with current folder name."
        (switch-to-buffer-other-window (car (wl-collect-summary))))
     (wl-summary-previous-buffer)))
 
+;;;
+;; Completion
+(defvar wl-folder-complete-folder-candidate nil)
+
+(defun wl-folder-complete-folder (string predicate flag)
+  (cond ((or (string-match "^\\(/[^/]*/\\)\\(.*\\)$" string) ; filter
+            (string-match "^\\(\*\\|\*.*,\\)\\([^,]*\\)$" string) ; multi
+            (string-match "^\\(|[^|]*|:?\\)\\(.*\\)$" string) ;pipe-src
+            (string-match "^\\(|\\)\\([^|]*\\)$" string)) ;pipe-dst
+        (let* ((str1 (match-string 1 string))
+               (str2 (match-string 2 string))
+               (str2-comp (wl-folder-complete-folder str2 predicate flag)))
+          (cond
+           ((listp str2-comp) ; flag=t
+            (mapcar (lambda (x) (concat str1 x)) str2-comp))
+           ((stringp str2-comp)
+            (concat str1 str2-comp))
+           (t
+            str2-comp))))
+       ((string-match "^\\(/\\)\\([^/]*\\)$" string) ; filter-condition
+        (let* ((str1 (match-string 1 string))
+               (str2 (match-string 2 string))
+               (str2-comp
+                (wl-folder-complete-filter-condition str2 predicate flag)))
+          (cond
+           ((listp str2-comp) ; flag=t
+            (mapcar (lambda (x) (concat str1 x)) str2-comp))
+           ((stringp str2-comp)
+            (concat str1 str2-comp))
+           (t
+            str2-comp))))
+       (t
+        (let ((candidate
+               (or wl-folder-complete-folder-candidate
+                   (if (memq 'read-folder wl-use-folder-petname)
+                       (wl-folder-get-entity-with-petname)
+                     wl-folder-entity-hashtb))))
+          (if (not flag)
+              (try-completion string candidate)
+            (all-completions string candidate))))))
+
+(defun wl-folder-complete-filter-condition (string predicate flag)
+  (cond
+   ((string-match "^\\(.*|\\|.*&\\|.*!\\|.*(\\)\\([^:]*\\)$" string)
+    (let* ((str1 (match-string 1 string))
+          (str2 (match-string 2 string))
+          (str2-comp
+           (wl-folder-complete-filter-condition str2 predicate flag)))
+      (cond
+       ((listp str2-comp) ; flag=t
+       (mapcar (lambda (x) (concat str1 x)) str2-comp))
+       ((stringp str2-comp)
+       (concat str1 str2-comp))
+       (t
+       str2-comp))))
+   (t
+    (let ((candidate
+          (mapcar (lambda (x) (list (concat (downcase x) ":")))
+                  (append '("last" "first"
+                            "from" "subject" "to" "cc" "body"
+                            "since" "before" "tocc")
+                          elmo-msgdb-extra-fields))))
+      (if (not flag)
+         (try-completion string candidate)
+       (all-completions string candidate))))))
+
+
 (require 'product)
 (product-provide (provide 'wl-folder) (require 'wl-version))
 
index 2911246..5621590 100644 (file)
@@ -3164,10 +3164,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
   (let ((fld (completing-read
              (format "Folder name %s(%s): " (or purpose "")
                      default)
-             (or wl-folder-completion-function
-                 (if (memq 'read-folder wl-use-folder-petname)
-                     (wl-folder-get-entity-with-petname)
-                   wl-folder-entity-hashtb))
+             'wl-folder-complete-folder
              nil nil (or init wl-default-spec)
              'wl-read-folder-hist)))
     (if (or (string= fld wl-default-spec)