GNU bug report logs - #13609
24.2.92; completion-list-insert-choice-function

Previous Next

Package: emacs;

Reported by: "Roland Winkler" <winkler <at> gnu.org>

Date: Sat, 2 Feb 2013 16:27:02 UTC

Severity: minor

Found in version 24.2.92

Done: "Roland Winkler" <winkler <at> gnu.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 13609 in the body.
You can then email your comments to 13609 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#13609; Package emacs. (Sat, 02 Feb 2013 16:27:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Roland Winkler" <winkler <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 02 Feb 2013 16:27:02 GMT) Full text and rfc822 format available.

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

From: "Roland Winkler" <winkler <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.2.92; completion-list-insert-choice-function
Date: Sat, 02 Feb 2013 10:24:57 -0600
The default value of completion-list-insert-choice-function
is completion--replace.  The `--' in the name of completion--replace
suggests to me that this is an internal function other code
should not rely on.  Yet isn't it a common scenario to bind
completion-list-insert-choice-function to a function which
calls completion--replace, plus it does something else?
(This is what bbdb-complete-mail does in BBDB v3.)

So I suggest to rename completion--replace to completion-replace
to make it clear that other code may use this function.
(Or solve this problem in some other way that other code may rely upon.)


In GNU Emacs 24.2.92.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.20.1)
 of 2013-01-10 on regnitz
Windowing system distributor `The X.Org Foundation', version 11.0.10706000
System Description:	Ubuntu 10.04.4 LTS




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13609; Package emacs. (Sun, 03 Feb 2013 13:53:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Roland Winkler" <winkler <at> gnu.org>
Cc: 13609 <at> debbugs.gnu.org
Subject: Re: bug#13609: 24.2.92; completion-list-insert-choice-function
Date: Sun, 03 Feb 2013 08:51:39 -0500
> So I suggest to rename completion--replace to completion-replace
> to make it clear that other code may use this function.

No, because some other package may already have changed
completion-list-insert-choice-function, so you should really read the
current value of completion-list-insert-choice-function, and then call
that (via `funcall') rather than hard-coding completion--replace.

> (Or solve this problem in some other way that other code may rely upon.)

As a matter of fact there's a new feature in trunk that does just that:
`add-function'.


        Stefan




Reply sent to "Roland Winkler" <winkler <at> gnu.org>:
You have taken responsibility. (Sun, 03 Feb 2013 15:48:01 GMT) Full text and rfc822 format available.

Notification sent to "Roland Winkler" <winkler <at> gnu.org>:
bug acknowledged by developer. (Sun, 03 Feb 2013 15:48:02 GMT) Full text and rfc822 format available.

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

From: "Roland Winkler" <winkler <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 13609-done <at> debbugs.gnu.org
Subject: Re: bug#13609: 24.2.92; completion-list-insert-choice-function
Date: Sun, 3 Feb 2013 09:46:49 -0600
On Sun Feb 3 2013 Stefan Monnier wrote:
> > So I suggest to rename completion--replace to completion-replace
> > to make it clear that other code may use this function.
> 
> No, because some other package may already have changed
> completion-list-insert-choice-function, so you should really read the
> current value of completion-list-insert-choice-function, and then call
> that (via `funcall') rather than hard-coding completion--replace.

Thank you, that makes sense, it solves my problem.

Possibly, such a strategy could even be mentioned in the docstring of
completion-list-insert-choice-function.  How about adding the
following sentences?

  If you want to bind this variable to a function calling the default
  value of this variable as part of its job, do not hard-code this value
  in your code as it may change in future versions of Emacs.
  Instead, read the current value of completion-list-insert-choice-function,
  then call that via `funcall'.

Of course, this is a generic issue with any foo-function variables
that come with a default.  Merely, I do not know where to put such
a more generic remark into the elisp manual so that you find it
when you need it.

> > (Or solve this problem in some other way that other code may rely upon.)
> 
> As a matter of fact there's a new feature in trunk that does just that:
> `add-function'.

Great, though I'll keep this for future versions of BBDB.  Right now
I want to keep BBDB 3 compatible with GNU Emacs 23 and 24.
(Sometimes this is hard when you have to ignore cool new stuff...)

Roland




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 04 Mar 2013 12:24:02 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 168 days ago.

Previous Next


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