GNU bug report logs - #12705
24.2.50; `Info-complete-menu-item' should use `add-to-list', not `push', to prevent duplicates

Previous Next

Package: emacs;

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

Date: Mon, 22 Oct 2012 16:29:02 UTC

Severity: normal

Found in version 24.2.50

Done: Chong Yidong <cyd <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 12705 in the body.
You can then email your comments to 12705 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#12705; Package emacs. (Mon, 22 Oct 2012 16:29: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. (Mon, 22 Oct 2012 16:29: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.2.50;
	`Info-complete-menu-item' should use `add-to-list', not `push', to
	prevent duplicates
Date: Mon, 22 Oct 2012 09:25:56 -0700
Subject line says it all.
 
This sexp:
(push (match-string-no-properties 1) completions)
 
should be changed to this:
(add-to-list 'completions (match-string-no-properties 1))

Otherwise the same entry can be added to `completions' multiple times.
 
This might not be manifested in *Completions*, because Emacs removes
duplicate candidates.  But in other completion setups (e.g. Icicles)
duplicate candidates (e.g. same display string, but perhaps different
alist elements) are sometimes allowed.
 
Yes, such other completion setups can specifically remove dups here.
But it would be more polite for `Info-complete-menu-item' to not create
dups in the first place.  There is never any reason for dups in this
context.

In GNU Emacs 24.2.50.1 (i386-mingw-nt5.1.2600)
 of 2012-10-15 on DANI-PC
Bzr revision: 110553 monnier <at> iro.umontreal.ca-20121015164957-6zms5w2js1xkldtg
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.7) --no-opt --enable-checking --cflags
 -I../../libs/libxpm-3.5.8/include -I../../libs/libxpm-3.5.8/src
 -I../../libs/libpng-1.4.10 -I../../libs/zlib-1.2.6
 -I../../libs/giflib-4.1.4-1/include -I../../libs/jpeg-6b-4/include
 -I../../libs/tiff-3.8.2-1/include
 -I../../libs/libxml2-2.7.8-w32-bin/include/libxml2
 -I../../libs/gnutls-3.0.16/include
 -I../../libs/libiconv-1.14-2-mingw32-dev/include'
 





bug closed, send any further explanations to 12705 <at> debbugs.gnu.org and "Drew Adams" <drew.adams <at> oracle.com> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 29 Oct 2012 10:48:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12705; Package emacs. (Mon, 29 Oct 2012 10:48:03 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> gnu.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 12705-done <at> debbugs.gnu.org
Subject: Re: bug#12705: 24.2.50;
	`Info-complete-menu-item' should use `add-to-list', not `push', to
	prevent duplicates
Date: Mon, 29 Oct 2012 18:44:36 +0800
"Drew Adams" <drew.adams <at> oracle.com> writes:

> This sexp:
> (push (match-string-no-properties 1) completions)
>  
> should be changed to this:
> (add-to-list 'completions (match-string-no-properties 1))
>
> Otherwise the same entry can be added to `completions' multiple times.
>  
> This might not be manifested in *Completions*, because Emacs removes
> duplicate candidates.  But in other completion setups (e.g. Icicles)
> duplicate candidates (e.g. same display string, but perhaps different
> alist elements) are sometimes allowed.

Sounds reasonable.  Done in trunk, using delete-dups instead of
add-to-list (in case info.el switches to lexical binding).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12705; Package emacs. (Mon, 29 Oct 2012 15:41:01 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Chong Yidong'" <cyd <at> gnu.org>
Cc: 12705-done <at> debbugs.gnu.org, 12705 <at> debbugs.gnu.org
Subject: RE: bug#12705: 24.2.50;
	`Info-complete-menu-item' should use `add-to-list', not `push', to
	prevent duplicates
Date: Mon, 29 Oct 2012 08:37:30 -0700
> Sounds reasonable.  Done in trunk, using delete-dups instead of
> add-to-list (in case info.el switches to lexical binding).

Thx.

Just curious - how would add-to-list interfere with lexical binding (or vice
versa)?

Seems odd that we would add and then delete, instead of adding only if not
present, just to dance around (the possibility of) lexical binding.

To be clear, I have no objection at all - nothing wrong with adding and then
deleting.  I'd just like to understand the problem being avoided.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12705; Package emacs. (Mon, 29 Oct 2012 15:41:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12705; Package emacs. (Mon, 29 Oct 2012 16:52:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 'Chong Yidong' <cyd <at> gnu.org>, 12705-done <at> debbugs.gnu.org,
	12705 <at> debbugs.gnu.org
Subject: Re: bug#12705: 24.2.50;
	`Info-complete-menu-item' should use `add-to-list', not `push', to
	prevent duplicates
Date: Mon, 29 Oct 2012 12:49:28 -0400
>> Sounds reasonable.  Done in trunk, using delete-dups instead of
>> add-to-list (in case info.el switches to lexical binding).

Isn't it better to use cl-pushnew?


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12705; Package emacs. (Mon, 29 Oct 2012 16:52:02 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. (Tue, 27 Nov 2012 12:24:03 GMT) Full text and rfc822 format available.

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

Previous Next


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