From 009d4e967175a706a7d7814962f42fcf336acd46 Mon Sep 17 00:00:00 2001 From: yoichi Date: Wed, 12 Feb 2003 00:37:49 +0000 Subject: [PATCH] * 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. --- wl/ChangeLog | 9 ++++++++ wl/wl-fldmgr.el | 2 +- wl/wl-folder.el | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++- wl/wl-summary.el | 5 +--- 4 files changed, 78 insertions(+), 6 deletions(-) diff --git a/wl/ChangeLog b/wl/ChangeLog index 21dbdc5..0c203b6 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,12 @@ +2003-02-12 Yoichi NAKAYAMA + + * 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 * wl-draft.el (wl-draft-send-confirm): New function. diff --git a/wl/wl-fldmgr.el b/wl/wl-fldmgr.el index c4aed76..699c390 100644 --- a/wl/wl-fldmgr.el +++ b/wl/wl-fldmgr.el @@ -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) diff --git a/wl/wl-folder.el b/wl/wl-folder.el index 262db0d..ad8a1dd 100644 --- a/wl/wl-folder.el +++ b/wl/wl-folder.el @@ -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)) diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 2911246..5621590 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -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) -- 1.7.10.4