Subject: bug#21058: closed (Re: 25.0.50; delete-dups doesn't delete all duplicates)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 16 Jul 2015 14:56:02 +0000

Your bug report

#21058: 25.0.50; delete-dups doesn't delete all duplicates

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
21058: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21058
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: 25.0.50; delete-dups doesn't delete all duplicates
From: Paul Eggert <[email-masked]>
To: Ari Roponen <[email-masked]>
Cc: [email-masked]
Date: Thu, 16 Jul 2015 07:55:44 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Thanks for the bug report and patch.  I installed it in your name as master 
commit 572cd26f3f03995dbb3689b8a6f0a575ec9b9cb6.

Subject: 25.0.50; delete-dups doesn't delete all duplicates
From: Ari Roponen <[email-masked]>
To: [email-masked]
Date: Wed, 15 Jul 2015 08:40:06 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

Function delete-dups doesn't delete all duplicates from long
lists:

(delete-dups (mapcar (lambda (x) (% x 3)) (number-sequence 0 102)))
=> (0 1 2 1 0 2 1 0 2 1 0 2 ...)

The following patch seems to fix the problem.

	* lisp/subr.el (delete-dups): Fix paren typo.

diff --git a/lisp/subr.el b/lisp/subr.el
index 5bd4bb4..e2c1bae 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -426,8 +426,8 @@ one is kept."
             (let ((elt (car retail)))
               (if (gethash elt hash)
                   (setcdr tail (cdr retail))
-                (puthash elt t hash)))
-            (setq tail retail)))
+                (puthash elt t hash)
+                (setq tail retail)))))
       (let ((tail list))
         (while tail
           (setcdr tail (delete (car tail) (cdr tail)))

In GNU Emacs 25.0.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.17.4)
 of 2015-07-14 on arirop
Repository revision: 6a7e718916d00dbacaa765669f389b86f33075f5
Windowing system distributor `Fedora Project', version 11.0.11702000
System Description:	Fedora release 23 (Rawhide)

-- 
Ari Roponen