* lisp/minibuffer.el (completion--try-word-completion): Revert fix for
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 5 May 2014 23:54:06 +0000 (19:54 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 5 May 2014 23:54:06 +0000 (19:54 -0400)
Bug#15980.

Fixes: debbugs:17375

lisp/ChangeLog
lisp/minibuffer.el

index 043a0c2..6aabf02 100644 (file)
@@ -1,5 +1,8 @@
 2014-05-05  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * minibuffer.el (completion--try-word-completion): Revert fix for
+       Bug#15980 (bug#17375).
+
        * xt-mouse.el (xterm-mouse--read-event-sequence-1000): (bug#17378)
        Always store button numbers in the same way in xterm-mouse-last;
        Don't burp is xterm-mouse-last is not set as expected.
index 87ba8a2..929ab3d 100644 (file)
@@ -1389,19 +1389,18 @@ appear to be a match."
         ;; instead, but it was too blunt, leading to situations where SPC
         ;; was the only insertable char at point but minibuffer-complete-word
         ;; refused inserting it.
-        (let* ((exts (mapcar (lambda (str) (propertize str 'completion-try-word t))
-                            '(" " "-")))
-              (before (substring string 0 point))
-              (after (substring string point))
-              (comps
-               (delete nil
-                       (mapcar (lambda (ext)
-                                 (completion-try-completion
-                                  (concat before ext after)
-                                  table predicate (1+ point) md))
-                               exts))))
-         (when (and (null (cdr comps)) (consp (car comps)))
-           (setq comp (car comps)))))
+        (let ((exts (mapcar (lambda (str) (propertize str 'completion-try-word t))
+                            '(" " "-")))
+              (before (substring string 0 point))
+              (after (substring string point))
+             tem)
+          ;; If both " " and "-" lead to completions, prefer " " so SPC behaves
+          ;; a bit more like a self-inserting key (bug#17375).
+         (while (and exts (not (consp tem)))
+            (setq tem (completion-try-completion
+                      (concat before (pop exts) after)
+                      table predicate (1+ point) md)))
+         (if (consp tem) (setq comp tem))))
 
       ;; Completing a single word is actually more difficult than completing
       ;; as much as possible, because we first have to find the "current