* wl-util.el (wl-completing-read-multiple-1): New internal function.
authorhmurata <hmurata>
Sun, 11 Dec 2005 09:11:20 +0000 (09:11 +0000)
committerhmurata <hmurata>
Sun, 11 Dec 2005 09:11:20 +0000 (09:11 +0000)
(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.

wl/ChangeLog
wl/wl-e21.el
wl/wl-mule.el
wl/wl-summary.el
wl/wl-util.el
wl/wl-xmas.el

index d11d07c..692ffbd 100644 (file)
@@ -1,3 +1,18 @@
+2005-12-11  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
+
+       * 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  <lapis-lazuli@pop06.odn.ne.jp>
 
        * wl-util.el (wl-filter-associations): New function.
index 701b317..e774304 100644 (file)
@@ -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)
index 10a8363..54b55da 100644 (file)
@@ -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))
 
index 5b3bf6a..c674d39 100644 (file)
@@ -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)
index f3eb0af..3c99879 100644 (file)
@@ -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))
 
index 0453980..55fe7d5 100644 (file)
@@ -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))