unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#12705: 24.2.50; `Info-complete-menu-item' should use `add-to-list', not `push', to prevent duplicates
@ 2012-10-22 16:25 Drew Adams
  2012-10-29 10:44 ` Chong Yidong
  0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2012-10-22 16:25 UTC (permalink / raw)
  To: 12705

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@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'
 






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#12705: 24.2.50; `Info-complete-menu-item' should use `add-to-list', not `push', to prevent duplicates
  2012-10-22 16:25 bug#12705: 24.2.50; `Info-complete-menu-item' should use `add-to-list', not `push', to prevent duplicates Drew Adams
@ 2012-10-29 10:44 ` Chong Yidong
  2012-10-29 15:37   ` Drew Adams
  0 siblings, 1 reply; 4+ messages in thread
From: Chong Yidong @ 2012-10-29 10:44 UTC (permalink / raw)
  To: Drew Adams; +Cc: 12705-done

"Drew Adams" <drew.adams@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).





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#12705: 24.2.50; `Info-complete-menu-item' should use `add-to-list', not `push', to prevent duplicates
  2012-10-29 10:44 ` Chong Yidong
@ 2012-10-29 15:37   ` Drew Adams
  2012-10-29 16:49     ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2012-10-29 15:37 UTC (permalink / raw)
  To: 'Chong Yidong'; +Cc: 12705, 12705-done

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






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#12705: 24.2.50; `Info-complete-menu-item' should use `add-to-list', not `push', to prevent duplicates
  2012-10-29 15:37   ` Drew Adams
@ 2012-10-29 16:49     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2012-10-29 16:49 UTC (permalink / raw)
  To: Drew Adams; +Cc: 'Chong Yidong', 12705, 12705-done

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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-29 16:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-22 16:25 bug#12705: 24.2.50; `Info-complete-menu-item' should use `add-to-list', not `push', to prevent duplicates Drew Adams
2012-10-29 10:44 ` Chong Yidong
2012-10-29 15:37   ` Drew Adams
2012-10-29 16:49     ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).