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

Previous Next

Package: emacs;

Reported by: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>

Date: Tue, 4 Mar 2014 14:13:02 UTC

Severity: normal

Tags: patch

Merged with 16933, 16934

Found in version 24.3.50

Done: Bastien <bzg <at> altern.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16935 in the body.
You can then email your comments to 16935 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#16935; Package emacs. (Tue, 04 Mar 2014 14:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nicolas Richard <theonewiththeevillook <at> yahoo.fr>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 04 Mar 2014 14:13:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50;
 when tab-completing in 'M-x' : "Wrong type argument: numberp, nil"
Date: Tue, 04 Mar 2014 15:12:42 +0100
Hi,

Reproduce:
emacs -Q -f toggle-debug-on-error --eval '(execute-kbd-macro (kbd "M-x f o o C-a <tab>"))'

backtrace:
Debugger entered--Lisp error: (wrong-type-argument numberp nil)
  zerop(nil)
  minibuffer-completion-help(5 8)
[the rest is of no particular interest]

Possible fix (i.e. Work© Fo® Me™):

--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1753,7 +1753,7 @@ variables.")
            (if completions "Sole completion" "No completions")))
 
       (let* ((last (last completions))
-             (base-size (cdr last))
+             (base-size (or (cdr last) 0))
              (prefix (unless (zerop base-size) (substring string 0 base-size)))
              (all-md (completion--metadata (buffer-substring-no-properties
                                             start (point))


-- 
Nico.




Added tag(s) patch. Request was from Nicolas Richard <theonewiththeevillook <at> yahoo.fr> to control <at> debbugs.gnu.org. (Tue, 04 Mar 2014 14:18:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16935; Package emacs. (Tue, 04 Mar 2014 14:28:04 GMT) Full text and rfc822 format available.

Message #10 received at 16935 <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
Cc: 16935 <at> debbugs.gnu.org
Subject: Re: bug#16935: 24.3.50;
 when tab-completing in 'M-x' : "Wrong type argument: numberp, nil"
Date: Tue, 04 Mar 2014 22:27:22 +0800
On 2014-03-04 22:12 +0800, Nicolas Richard wrote:
> --- a/lisp/minibuffer.el
> +++ b/lisp/minibuffer.el
> @@ -1753,7 +1753,7 @@ variables.")
>             (if completions "Sole completion" "No completions")))
>  
>        (let* ((last (last completions))
> -             (base-size (cdr last))
> +             (base-size (or (cdr last) 0))
>               (prefix (unless (zerop base-size) (substring string 0 base-size)))
>               (all-md (completion--metadata (buffer-substring-no-properties
>                                              start (point))

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.

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16935; Package emacs. (Tue, 04 Mar 2014 14:40:02 GMT) Full text and rfc822 format available.

Message #13 received at 16935 <at> debbugs.gnu.org (full text, mbox):

From: Bastien <bzg <at> altern.org>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>, 16935 <at> debbugs.gnu.org
Subject: Re: bug#16935: 24.3.50; when tab-completing in 'M-x' : "Wrong type
 argument: numberp, nil"
Date: Tue, 04 Mar 2014 15:39:33 +0100
Leo Liu <sdl.web <at> gmail.com> writes:

> On 2014-03-04 22:12 +0800, Nicolas Richard wrote:
>> --- a/lisp/minibuffer.el
>> +++ b/lisp/minibuffer.el
>> @@ -1753,7 +1753,7 @@ variables.")
>>             (if completions "Sole completion" "No completions")))
>>  
>>        (let* ((last (last completions))
>> -             (base-size (cdr last))
>> +             (base-size (or (cdr last) 0))
>>               (prefix (unless (zerop base-size) (substring string 0 base-size)))
>>               (all-md (completion--metadata (buffer-substring-no-properties
>>                                              start (point))
>
> 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.

Sorry -- I just saw Nicolas email and yours.  Hopefully, I came up
with the same fix.

The error originated here:
http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=66c5fecc

The commit makes `base-size' optional, so we need to ensure it
falls back to 0 instead of nil.

-- 
 Bastien




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16935; Package emacs. (Tue, 04 Mar 2014 15:04:01 GMT) Full text and rfc822 format available.

Message #16 received at 16935 <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
To: Bastien <bzg <at> altern.org>
Cc: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>,
 Leo Liu <sdl.web <at> gmail.com>, 16935 <at> debbugs.gnu.org
Subject: Re: bug#16935: 24.3.50;
 when tab-completing in 'M-x' : "Wrong type argument: numberp, nil"
Date: Tue, 04 Mar 2014 16:03:15 +0100
Bastien <bzg <at> altern.org> writes:
> Leo Liu <sdl.web <at> gmail.com> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16935; Package emacs. (Tue, 04 Mar 2014 15:15:02 GMT) Full text and rfc822 format available.

Message #19 received at 16935 <at> debbugs.gnu.org (full text, mbox):

From: Bastien <bzg <at> altern.org>
To: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
Cc: 16935 <at> debbugs.gnu.org, Leo Liu <sdl.web <at> gmail.com>
Subject: Re: bug#16935: 24.3.50; when tab-completing in 'M-x' : "Wrong type
 argument: numberp, nil"
Date: Tue, 04 Mar 2014 16:13:42 +0100
Hi Nicolas,

Nicolas Richard <theonewiththeevillook <at> yahoo.fr> writes:

> 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 ?

I checked occurrences of `base-size' in minibuffer.el and we're
covered.  Other occurrences in simple.el are explicitely bound to
`completion-base-size', so I don't think there is a problem here.

-- 
 Bastien




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16935; Package emacs. (Tue, 04 Mar 2014 17:04:02 GMT) Full text and rfc822 format available.

Message #22 received at 16935 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Bastien <bzg <at> altern.org>
Cc: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>,
 Leo Liu <sdl.web <at> gmail.com>, 16935 <at> debbugs.gnu.org
Subject: Re: bug#16935: 24.3.50;
 when tab-completing in 'M-x' : "Wrong type argument: numberp, nil"
Date: Tue, 04 Mar 2014 12:03:47 -0500
Bastien wrote:

> The error originated here:
> http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=66c5fecc
>
> The commit makes `base-size' optional, so we need to ensure it
> falls back to 0 instead of nil.

Making an argument optional couldn't cause this. It was the other part
of that commit, just now reverted.




Forcibly Merged 16933 16934 16935. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 04 Mar 2014 17:05:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16935; Package emacs. (Tue, 04 Mar 2014 17:23:02 GMT) Full text and rfc822 format available.

Message #27 received at 16935 <at> debbugs.gnu.org (full text, mbox):

From: Bastien <bzg <at> altern.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>,
 Leo Liu <sdl.web <at> gmail.com>, 16935 <at> debbugs.gnu.org
Subject: Re: bug#16935: 24.3.50; when tab-completing in 'M-x' : "Wrong type
 argument: numberp, nil"
Date: Tue, 04 Mar 2014 18:21:59 +0100
Glenn Morris <rgm <at> gnu.org> writes:

> Making an argument optional couldn't cause this. It was the other part
> of that commit, just now reverted.

Thanks,

-- 
 Bastien




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16935; Package emacs. (Wed, 05 Mar 2014 00:17:02 GMT) Full text and rfc822 format available.

Message #30 received at 16935 <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Bastien <bzg <at> altern.org>, 16935 <at> debbugs.gnu.org,
 Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
Subject: Re: bug#16935: 24.3.50;
 when tab-completing in 'M-x' : "Wrong type argument: numberp, nil"
Date: Wed, 05 Mar 2014 08:15:54 +0800
On 2014-03-05 01:03 +0800, Glenn Morris wrote:
> Making an argument optional couldn't cause this. It was the other part
> of that commit, just now reverted.

Seems Bastien's fix can be reverted as well. If data is corrupted, the
error can help identify the real cause.

Thanks,
Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16935; Package emacs. (Wed, 05 Mar 2014 07:09:02 GMT) Full text and rfc822 format available.

Message #33 received at 16935 <at> debbugs.gnu.org (full text, mbox):

From: Bastien <bzg <at> altern.org>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, 16935 <at> debbugs.gnu.org,
 Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
Subject: Re: bug#16935: 24.3.50; when tab-completing in 'M-x' : "Wrong type
 argument: numberp, nil"
Date: Wed, 05 Mar 2014 08:08:11 +0100
Leo Liu <sdl.web <at> gmail.com> writes:

> On 2014-03-05 01:03 +0800, Glenn Morris wrote:
>> Making an argument optional couldn't cause this. It was the other part
>> of that commit, just now reverted.
>
> Seems Bastien's fix can be reverted as well. If data is corrupted, the
> error can help identify the real cause.

Agreed and done.  (I made the revert manually as I wasn't sure on how
to use bzr merge to revert a single commit.)

-- 
 Bastien




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 02 Apr 2014 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 139 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.