From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Liu Newsgroups: gmane.emacs.devel Subject: Re: fix for bug 10994 breaks ido customizations in major way Date: Wed, 08 May 2013 11:10:12 +0800 Message-ID: References: <87txmfyb9n.fsf@gmail.com> <432AFE3B3321498E9B17075D3B55A60B@us.oracle.com> <87y5bqty1w.fsf@gmail.com> <87wqrar2g9.fsf@wanadoo.es> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1367982627 15977 80.91.229.3 (8 May 2013 03:10:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 8 May 2013 03:10:27 +0000 (UTC) Cc: emacs-devel@gnu.org To: Le Wang Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 08 05:10:26 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UZult-0004B8-Sk for ged-emacs-devel@m.gmane.org; Wed, 08 May 2013 05:10:26 +0200 Original-Received: from localhost ([::1]:47843 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZult-0006jA-5I for ged-emacs-devel@m.gmane.org; Tue, 07 May 2013 23:10:25 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZulo-0006hm-Ku for emacs-devel@gnu.org; Tue, 07 May 2013 23:10:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZuln-0001hQ-EW for emacs-devel@gnu.org; Tue, 07 May 2013 23:10:20 -0400 Original-Received: from mail-pb0-x236.google.com ([2607:f8b0:400e:c01::236]:43924) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZuln-0001hI-7j for emacs-devel@gnu.org; Tue, 07 May 2013 23:10:19 -0400 Original-Received: by mail-pb0-f54.google.com with SMTP id rr4so873349pbb.41 for ; Tue, 07 May 2013 20:10:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:face:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=GjtFFyKcsJuAWX+m/gMkTye6hv6X6iJgL6XIA7U/yNA=; b=ydWkH+v9vL7C9nNqA3LfMQEbEubGtxwp75ffedvhEADTCtsSZdWPjbQeBbV4NiahnV 1DdkDmS7BiKcMq1xflyPX34Ubx0LqtioqZ1MRY4GAA8KmbBELrJbly7Oug0fFEcN+Dfg PvHokkfVOI0RodkPUzPDsKEvaDt4G60NbLQmYwHtk0FBkPX2GR+uGCjcemMT9Koi12wT S4PK8+qXoq0JtwJ41KiuQ+IT+MJgqOKO2dgEwaoonONpkp3D0qxfPYRpp2QhyPfYUABS 5ghe2nDVH8F6mhFhr7ulXuz7foS4R6g9CAECgGh9Nc3fw5Jed2WulpdIOWACCo80xFJt qdcQ== X-Received: by 10.68.172.65 with SMTP id ba1mr5383206pbc.166.1367982618426; Tue, 07 May 2013 20:10:18 -0700 (PDT) Original-Received: from localhost (li511-224.members.linode.com. [66.175.216.224]) by mx.google.com with ESMTPSA id uq10sm12464975pbc.5.2013.05.07.20.10.16 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 07 May 2013 20:10:17 -0700 (PDT) Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAGFBMVEUzRVhbQj4eZqO6SjnT eWpxnMetm5b6/PmidmqrAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1F B9cBBwMLBfKABCMAAAFoSURBVCjPtZI9a8MwEIaFoc7aYDdelQMna0Em3tsSr0XUeE2Q6a22a+v+ fk8fSSBkbDUI6dHpfe9OEvRgiD+ApqKPJgJeB6iUUXWESjUe/ig38AJrhqqvaU2nTIXbNvOQ40fe qdry4kyGoVWsfCQalXpHnJGM01wjWdYbMlXNFdsZDO69m9aqNqxEJqTEgbM5OF7wlEfIoll1Ked4 LbM5X2EdILLokEdmI8z7g5cKED0cuTC930TYhy7ZDekkXVGw/L60TguJePPxcJF48lpsSUWEA/Ju jGFNgJOXc4Hz7TmAdBeu5Ve4AEjOi2/2jfd3cAJZ+IbNrvdjgBZY01b+HTuG3cLws6BJZqVOj/pp T0OqVwx3rFq+QmJwx3loK5JSLEhDIt62+mtC2C+SrAUxEbV6C6v2BRbd6pILBKFpepKZJHgGgrKF sptSUUoczpwg2pQ7ZH1tgs0ou/917mzz6Cs2//C978cv5l07L02orIEAAAAASUVORK5CYII= In-Reply-To: (Le Wang's message of "Wed, 8 May 2013 08:35:58 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c01::236 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:159416 Archived-At: Your posts don't help your case when people are trying to be constructive. Nevertheless I have reviewed your last patch: 1. renamed to ido-delete-consecutive-dups for clarify 2. fix a bug so that it can handle duplicates at the end that also coincide with the head HTH, Leo diff --git a/lisp/ido.el b/lisp/ido.el index e335758e..10bff015 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -3170,15 +3170,13 @@ (defun ido-restrict-to-matches () (exit-minibuffer))) (defun ido-chop (items elem) - "Remove all elements before ELEM and put them at the end of ITEMS. -Use `eq' for comparison." + "Remove all elements before ELEM and put them at the end of ITEMS." (let ((ret nil) (next nil) (sofar nil)) (while (not ret) (setq next (car items)) - ;; Use `eq' to avoid bug http://debbugs.gnu.org/10994 - (if (eq next elem) + (if (equal next elem) (setq ret (append items (nreverse sofar))) ;; else (progn @@ -3806,7 +3804,7 @@ (defun ido-set-matches-1 (items &optional do-full) (if (string-match re name) (setq matches (cons item matches))))) items)) - matches)) + (ido-delete-consecutive-dups matches))) (defun ido-set-matches () @@ -4729,6 +4727,21 @@ (defun ido-summary-buffers-to-end () ido-temp-list)))) (ido-to-end summaries))) +(defun ido-delete-consecutive-dups (list) + "Destructively delete consecutive duplicates in LIST. +Use `equal' for comparison. First and last elements are +considered consecutive." + (let ((tail list) + (last (make-symbol "")) + (result nil)) + (while (consp tail) + (unless (equal (car tail) last) + (push (setq last (car tail)) result)) + (setq tail (cdr tail))) + (nreverse (if (equal last (car list)) + (cdr result) + result)))) + ;;; Helper functions for other programs (put 'dired-do-rename 'ido 'ignore)