* minibuffer.el (completion-hilit-commonality): Revert 2014-03-01 short-cut,
authorGlenn Morris <rgm@gnu.org>
Tue, 4 Mar 2014 17:01:37 +0000 (09:01 -0800)
committerGlenn Morris <rgm@gnu.org>
Tue, 4 Mar 2014 17:01:37 +0000 (09:01 -0800)
which changed the return value.

Fixes: debbugs:16933

lisp/ChangeLog
lisp/minibuffer.el

index 52d2728..939f150 100644 (file)
@@ -1,3 +1,8 @@
+2014-03-04  Glenn Morris  <rgm@gnu.org>
+
+       * minibuffer.el (completion-hilit-commonality):
+       Revert 2014-03-01 short-cut, which changed the return value. (Bug#16933)
+
 2014-03-04  Juanma Barranquero  <lekktu@gmail.com>
 
        * hilit-chg.el (hilit-chg-unload-function): New function.
index da3a8ad..526fdb6 100644 (file)
@@ -1597,36 +1597,34 @@ This adds the face `completions-common-part' to the first
 It returns a list with font-lock properties applied to each element,
 and with BASE-SIZE appended as the last element."
   (when completions
-    (if (zerop prefix-len)
-        completions
-      (let ((com-str-len (- prefix-len (or base-size 0))))
-        (nconc
-         (mapcar
-          (lambda (elem)
-            (let ((str
-                   ;; Don't modify the string itself, but a copy, since the
-                   ;; the string may be read-only or used for other purposes.
-                   ;; Furthermore, since `completions' may come from
-                   ;; display-completion-list, `elem' may be a list.
-                   (if (consp elem)
-                       (car (setq elem (cons (copy-sequence (car elem))
-                                             (cdr elem))))
-                     (setq elem (copy-sequence elem)))))
-              (font-lock-prepend-text-property
-               0
-               ;; If completion-boundaries returns incorrect
-               ;; values, all-completions may return strings
-               ;; that don't contain the prefix.
-               (min com-str-len (length str))
-               'face 'completions-common-part str)
-              (if (> (length str) com-str-len)
-                  (font-lock-prepend-text-property com-str-len (1+ com-str-len)
-                                                   'face
-                                                   'completions-first-difference
-                                                   str)))
-            elem)
-          completions)
-         base-size)))))
+    (let ((com-str-len (- prefix-len (or base-size 0))))
+      (nconc
+       (mapcar
+        (lambda (elem)
+          (let ((str
+                 ;; Don't modify the string itself, but a copy, since the
+                 ;; the string may be read-only or used for other purposes.
+                 ;; Furthermore, since `completions' may come from
+                 ;; display-completion-list, `elem' may be a list.
+                 (if (consp elem)
+                     (car (setq elem (cons (copy-sequence (car elem))
+                                           (cdr elem))))
+                   (setq elem (copy-sequence elem)))))
+            (font-lock-prepend-text-property
+             0
+             ;; If completion-boundaries returns incorrect
+             ;; values, all-completions may return strings
+             ;; that don't contain the prefix.
+             (min com-str-len (length str))
+             'face 'completions-common-part str)
+            (if (> (length str) com-str-len)
+                (font-lock-prepend-text-property com-str-len (1+ com-str-len)
+                                                 'face
+                                                 'completions-first-difference
+                                                 str)))
+          elem)
+        completions)
+       base-size))))
 
 (defun display-completion-list (completions &optional common-substring)
   "Display the list of completions, COMPLETIONS, using `standard-output'.