Subject: bug#16935: 24.3.50; when tab-completing in 'M-x' : "Wrong type argument: numberp, nil"

From: Nicolas Richard <[email-masked]>
Date: Tue, 04 Mar 2014 16:03:15 +0100

Bastien <[email-masked]> writes:
> Leo Liu <[email-masked]> writes:
>> I noticed this error too. (base-size (cdr last)) is used in 24.3 and no
>> errors there. So it will be good to know where the problem originated
>> and fix it.
> The commit makes `base-size' optional, so we need to ensure it
> falls back to 0 instead of nil.

Shouldn't base-size default to 0 in completion-hilit-commonality then,
to avoid having to fix code that relies on base-size being an integer
everywhere else ? Or were all such occurrences found already ?

--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1595,11 +1595,12 @@ This adds the face `completions-common-part' to the first
 `completions-first-difference' to the first character after that.
 
 It returns a list with font-lock properties applied to each element,
-and with BASE-SIZE appended as the last element."
+and with BASE-SIZE (or zero) appended as the last element."
+  (or base-size (setq base-size 0))
   (when completions
     (if (zerop prefix-len)
         completions
-      (let ((com-str-len (- prefix-len (or base-size 0))))
+      (let ((com-str-len (- prefix-len base-size)))
         (nconc
          (mapcar
           (lambda (elem)

-- 
Nico.