From: hmurata Date: Sun, 11 Dec 2005 09:11:20 +0000 (+0000) Subject: * wl-util.el (wl-completing-read-multiple-1): New internal function. X-Git-Tag: wl-2_15_3~31 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=f68b35fe652684dd438117fddc5bb07e168ebf8b;p=elisp%2Fwanderlust.git * wl-util.el (wl-completing-read-multiple-1): New internal function. (wl-completing-read-multiple-2): Ditto. (wl-completing-read-multiple): Define use above functions. * wl-summary.el (wl-summary-sort): Removed the workaround for a bug of `completing-read-multiple' about default value. * wl-xmas.el (wl-completing-read-multiple): Removed. * wl-mule.el (wl-completing-read-multiple): Ditto. * wl-e21.el (wl-completing-read-multiple): Ditto. --- diff --git a/wl/ChangeLog b/wl/ChangeLog index d11d07c..692ffbd 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,18 @@ +2005-12-11 Hiroya Murata + + * wl-util.el (wl-completing-read-multiple-1): New internal function. + (wl-completing-read-multiple-2): Ditto. + (wl-completing-read-multiple): Define use above functions. + + * wl-summary.el (wl-summary-sort): Removed the workaround for a + bug of `completing-read-multiple' about default value. + + * wl-xmas.el (wl-completing-read-multiple): Removed. + + * wl-mule.el (wl-completing-read-multiple): Ditto. + + * wl-e21.el (wl-completing-read-multiple): Ditto. + 2005-12-10 Hiroya Murata * wl-util.el (wl-filter-associations): New function. diff --git a/wl/wl-e21.el b/wl/wl-e21.el index 701b317..e774304 100644 --- a/wl/wl-e21.el +++ b/wl/wl-e21.el @@ -677,8 +677,6 @@ Special commands: (let ((event (read-event))) (cons (and (numberp event) event) event))) -(defalias 'wl-completing-read-multiple 'completing-read-multiple) - (put 'wl-modeline-biff-state-on 'risky-local-variable t) (put 'wl-modeline-biff-state-off 'risky-local-variable t) (put 'wl-modeline-plug-state-on 'risky-local-variable t) diff --git a/wl/wl-mule.el b/wl/wl-mule.el index 10a8363..54b55da 100644 --- a/wl/wl-mule.el +++ b/wl/wl-mule.el @@ -308,14 +308,6 @@ Warning: Unknown req `%S' with options `%S'" req options) (let ((event (read-event))) (cons (and (numberp event) event) event))) -(defun wl-completing-read-multiple (prompt - table - &optional predicate - require-match initial-input) - "Read multiple strings in the minibuffer" - (split-string (completing-read prompt table predicate require-match - initial-input) ",")) - (require 'product) (product-provide (provide 'wl-mule) (require 'wl-version)) diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 5b3bf6a..c674d39 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -1914,18 +1914,17 @@ This function is defined for `window-scroll-functions'" (defun wl-summary-sort (reverse) "Sort summary lines into the selected order; argument means descending order." (interactive "P") - (let ((spec (wl-completing-read-multiple - (format "%s by (%s): " - (if reverse "Reverse sort" "Sort") - (symbol-name wl-summary-default-sort-spec)) - (nconc - (mapcar (lambda (spec) (list (symbol-name spec))) - wl-summary-sort-specs) - (mapcar (lambda (spec) (list (concat "!" (symbol-name spec)))) - wl-summary-sort-specs)) - nil t))) + (let ((default-value (symbol-name wl-summary-default-sort-spec))) (wl-summary-rescan - (if (equal spec '("")) (symbol-name wl-summary-default-sort-spec) spec) + (wl-completing-read-multiple + (format "%s by (%s): " (if reverse "Reverse sort" "Sort") default-value) + (nconc + (mapcar (lambda (spec) (list (symbol-name spec))) + wl-summary-sort-specs) + (mapcar (lambda (spec) (list (concat "!" (symbol-name spec)))) + wl-summary-sort-specs)) + nil t nil nil + default-value) reverse))) (defun wl-summary-get-available-flags (&optional include-specials) diff --git a/wl/wl-util.el b/wl/wl-util.el index f3eb0af..3c99879 100644 --- a/wl/wl-util.el +++ b/wl/wl-util.el @@ -1099,6 +1099,56 @@ is enclosed by at least one regexp grouping construct." (setq value (prin1-to-string value))) (concat (downcase field) ":" value))))) + +;; read multiple strings with completion +(defun wl-completing-read-multiple-1 (prompt + table + &optional predicate + require-match initial-input + hist def inherit-input-method) + "Read multiple strings in the minibuffer" + (split-string + (completing-read prompt table predicate nil + initial-input hist def inherit-input-method) + ",")) + +(static-when (fboundp 'completing-read-multiple) + (eval-when-compile + (require 'crm)) + (defun wl-completing-read-multiple-2 (prompt + table + &optional predicate + require-match initial-input + hist def inherit-input-method) + "Read multiple strings in the minibuffer" + (let ((ret (completing-read-multiple prompt table predicate + require-match initial-input + hist def inherit-input-method))) + (if (and def (equal ret '(""))) + (split-string def crm-separator) + ret)))) + +(static-cond + ((not (fboundp 'completing-read-multiple)) + (defalias 'wl-completing-read-multiple 'wl-completing-read-multiple-1)) + ((< emacs-major-version 22) + (defun wl-completing-read-multiple (prompt + table + &optional predicate + require-match initial-input + hist def inherit-input-method) + "Read multiple strings in the minibuffer" + (if require-match + (wl-completing-read-multiple-1 prompt table predicate + nil initial-input + hist def inherit-input-method) + (wl-completing-read-multiple-2 prompt table predicate + nil initial-input + hist def inherit-input-method)))) + (t + (defalias 'wl-completing-read-multiple 'wl-completing-read-multiple-2))) + + (require 'product) (product-provide (provide 'wl-util) (require 'wl-version)) diff --git a/wl/wl-xmas.el b/wl/wl-xmas.el index 0453980..55fe7d5 100644 --- a/wl/wl-xmas.el +++ b/wl/wl-xmas.el @@ -567,14 +567,6 @@ Special commands: (event-to-character event)) event))) -(defun wl-completing-read-multiple (prompt - table - &optional predicate - require-match initial-input) - "Read multiple strings in the minibuffer" - (split-string (completing-read prompt table predicate require-match - initial-input) ",")) - (require 'product) (product-provide (provide 'wl-xmas) (require 'wl-version))