GNU bug report logs - #14153
24.3.50; regression: `crm--choose-completion-string' expects wrong args

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Sat, 6 Apr 2013 21:30:02 UTC

Severity: minor

Found in version 24.3.50

Fixed in version 24.4

Done: Lars Ingebrigtsen <larsi <at> gnus.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 14153 in the body.
You can then email your comments to 14153 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#14153; Package emacs. (Sat, 06 Apr 2013 21:30:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 06 Apr 2013 21:30:02 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 24.3.50;
	regression: `crm--choose-completion-string' expects wrong args
Date: Sat, 6 Apr 2013 14:25:34 -0700
A regression introduced in Emacs 23.  There is no problem before 23.

`completing-read-multiple' adds `crm--choose-completion-string' to
`choose-completion-string-functions'.
 
But `crm--choose-completion-string' has the wrong signature for a
function on `choose-completion-string-functions'.
 
Each such function should accept 4 args, as follows:
 
 CHOICE - the string to insert in the buffer,
 BUFFER - the buffer in which the choice should be inserted,
 MINI-P - non-nil if BUFFER is a minibuffer, and
 BASE-SIZE - the number of characters in BUFFER before
          the string being completed.
 
But `crm--choose-completion-string' expects these args:
 
 (CHOICE  BUFFER  BASE-POSITION  &rest IGNORED)

In particular, it expects the third arg to be a position,
not a Boolean indicator of whether BUFFER is a minibuffer.
 
If the BUFFER is a minibuffer, so that MINI-P is non-nil
(e.g. `t'), then `crm--choose-completion-string'
mistakenly interprets that value as the BASE-POSITION.
 
In code that I have this leads to this kind of error:
 
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p t)
  choose-completion-string("mode-line" #<buffer  *Minibuf-1*> t)
  crm--choose-completion-string("mode-line" #<buffer  *Minibuf-1*> t nil)
  run-hook-with-args-until-success(crm--choose-completion-string "mode-line"
                                    #<buffer  *Minibuf-1*> t nil)
 
Presumably no one has run into this because their code hasn't passed t
as the value of MINI-P (?).

 
In GNU Emacs 24.3.50.1 (i386-mingw-nt5.1.2600)
 of 2013-04-02 on ODIEONE
Bzr revision: 112212 cyd <at> gnu.org-20130402033331-sqegwhqh7u1o0ars
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.7) --no-opt --enable-checking --cflags
 -IC:/Devel/emacs/build/include --ldflags -LC:/Devel/emacs/build/lib'
 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14153; Package emacs. (Sun, 07 Apr 2013 00:50:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 14153 <at> debbugs.gnu.org
Subject: Re: bug#14153: 24.3.50;
	regression: `crm--choose-completion-string' expects wrong args
Date: Sat, 06 Apr 2013 20:46:10 -0400
> Each such function should accept 4 args, as follows:
 
>  CHOICE - the string to insert in the buffer,
>  BUFFER - the buffer in which the choice should be inserted,
>  MINI-P - non-nil if BUFFER is a minibuffer, and
>  BASE-SIZE - the number of characters in BUFFER before
>           the string being completed.

Duh, sorry indeed, could you please update this docstring to match the code?

> But `crm--choose-completion-string' expects these args:
>  (CHOICE  BUFFER  BASE-POSITION  &rest IGNORED)

Which is indeed the correct calling convention nowadays.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14153; Package emacs. (Sun, 07 Apr 2013 02:05:02 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>
Cc: 14153 <at> debbugs.gnu.org
Subject: RE: bug#14153: 24.3.50;
	regression: `crm--choose-completion-string' expects wrong args
Date: Sat, 6 Apr 2013 19:00:57 -0700
> > Each such function should accept 4 args, as follows:
>  
> >  CHOICE - the string to insert in the buffer,
> >  BUFFER - the buffer in which the choice should be inserted,
> >  MINI-P - non-nil if BUFFER is a minibuffer, and
> >  BASE-SIZE - the number of characters in BUFFER before
> >           the string being completed.
> 
> Duh, sorry indeed, could you please update this docstring to 
> match the code?

Sorry, I don't know what the new code parameters mean.  S?he who changes the
signature is best placed to update the spec/doc of that signature.

> > But `crm--choose-completion-string' expects these args:
> >  (CHOICE  BUFFER  BASE-POSITION  &rest IGNORED)
> 
> Which is indeed the correct calling convention nowadays.

How do you deal with older code that calls with a MINI-P parameter?

It's one thing to ignore old parameters that you don't need anymore.  It's quite
another thing to change the signature so much that old calls provoke errors.

This is apparently not about some particular function such as
`crm--choose-completion-string'.  It is about
`choose-completion-string-functions', which has been around a long time and is a
general purpose hook.

Anyway, since you've changed the code, please change the doc string accordingly,
whatever that might mean/entail.  Thx.  If you really need help with the
wording, then communicate the meaning (content), and I will be glad to suggest
wording.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14153; Package emacs. (Sun, 07 Apr 2013 02:13:02 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>
Cc: 14153 <at> debbugs.gnu.org
Subject: RE: bug#14153: 24.3.50;
	regression: `crm--choose-completion-string' expects wrong args
Date: Sat, 6 Apr 2013 19:09:21 -0700
I now see an entry in the Emacs 23 NEWS about this (good), now that I know what
the change is, so what to look for (`choose-completion-string-functions').





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14153; Package emacs. (Sat, 08 Feb 2014 12:48:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Drew Adams <drew.adams <at> oracle.com>, 14153 <at> debbugs.gnu.org
Subject: Re: bug#14153: 24.3.50;
 regression: `crm--choose-completion-string' expects wrong args
Date: Sat, 08 Feb 2014 04:46:28 -0800
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> Each such function should accept 4 args, as follows:
>
>>  CHOICE - the string to insert in the buffer,
>>  BUFFER - the buffer in which the choice should be inserted,
>>  MINI-P - non-nil if BUFFER is a minibuffer, and
>>  BASE-SIZE - the number of characters in BUFFER before
>>           the string being completed.
>
> Duh, sorry indeed, could you please update this docstring to match the code?
>
>> But `crm--choose-completion-string' expects these args:
>>  (CHOICE  BUFFER  BASE-POSITION  &rest IGNORED)
>
> Which is indeed the correct calling convention nowadays.

Fixed on trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




bug marked as fixed in version 24.4, send any further explanations to 14153 <at> debbugs.gnu.org and "Drew Adams" <drew.adams <at> oracle.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 08 Feb 2014 12:49:04 GMT) Full text and rfc822 format available.

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

This bug report was last modified 10 years and 72 days ago.

Previous Next


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