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 12:49:53 +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 1367988614 32272 80.91.229.3 (8 May 2013 04:50:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 8 May 2013 04:50:14 +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 06:50:14 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 1UZwKU-00085v-7i for ged-emacs-devel@m.gmane.org; Wed, 08 May 2013 06:50:14 +0200 Original-Received: from localhost ([::1]:58191 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZwKT-0002fu-3E for ged-emacs-devel@m.gmane.org; Wed, 08 May 2013 00:50:13 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:52153) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZwKP-0002eX-JR for emacs-devel@gnu.org; Wed, 08 May 2013 00:50:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZwKL-0006x2-90 for emacs-devel@gnu.org; Wed, 08 May 2013 00:50:09 -0400 Original-Received: from mail-pb0-x236.google.com ([2607:f8b0:400e:c01::236]:51215) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZwKL-0006ut-32 for emacs-devel@gnu.org; Wed, 08 May 2013 00:50:05 -0400 Original-Received: by mail-pb0-f54.google.com with SMTP id rr4so927557pbb.27 for ; Tue, 07 May 2013 21:50:04 -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=wKWt7gxbEZ6c591XUQhHmefxqQyCrVG8z/jerWcVGOQ=; b=bMlkc0jYRGJMlcNa9u+ej+MMwqjS3QtB0onLvyGOvwmNkFRnLmba2KjFUPASZtKpP5 10AhaGqX0/LOGIW6UWhENHSyAzT4WZS8fKCZxt9XqMapZly524I32OjEcKD9fxhZjjg2 EpyeNcPI9PsRijkks6QPceKeH0XPsgI82vdpyC7Qo4k6VUm7F2Leo0cM8CIkej7xeolL hLMQ3/hlmm3qqu9sAggGmWX533yx8Ju3PsSmZVsn6/uAigtm4PaeAxy+6qT2y5DijZU7 DWB3LRacnRvJz+ENUeOoY0tGt4Brfc8JoNS+FYt5RJbKBHdBhaC13jhlyRqawq+l8a+h v4CA== X-Received: by 10.68.253.230 with SMTP id ad6mr5376702pbd.182.1367988603940; Tue, 07 May 2013 21:50:03 -0700 (PDT) Original-Received: from Zeuss-MacBook.local (li511-224.members.linode.com. [66.175.216.224]) by mx.google.com with ESMTPSA id qi1sm33210213pac.21.2013.05.07.21.49.59 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 07 May 2013 21:50:03 -0700 (PDT) Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAGFBMVEUKDAg1NjRWV1V9fnyg op/DxcLk5uP8/voi63ReAAAACXBIWXMAAAWJAAAFiQFtaJ36AAAAB3RJTUUH1goZAgAz00bgXgAA AeVJREFUKM9lk0Fz2jAQhQXJD3CCO70CmcC1YMtcWyTZ14Bl69xats4N9r6/3zWQBlodNKNPu/s0 b1cCQFuZGpfVVh3vAvBJolIXRkapSuoRUtIdFyo1Y5xSdlAj7OtvD1XnXxmWRi+eWgcxyCed1lVV B1CrKyujMoi+eLA5kU1SsjoHlW+nQjTtFxk4MXgrOxvIqzoTZR8XgPaLl419zgsMaSGFPiUOZCIh thsx5Xy9NsK8Kwf/JoQgMxcVJ301HKkcSWaT0O7FY056J4U9xcYfnmVXG4801lW6lqwu2nKFZoHC HuzvaTVndZ+LaRQgZdthXw1cpynEkLEwyFHXk/aIxNQ6QeooJuzPMB+wn+D7JJNsiCcVA13/A3h/ xE9J+WidpAwoYNmRFwyvSRhNVtsdaAewzZZP5uw82QL9+tyNfocyP0McAzICUr5Mk9RdIjWasUNx aIIt6NK4ZtXIMdfMQt3nuMAyWbLI4DqZ4xPq/ag8jPond4XU/cLuOgw6XCFX/YCUfcDAMMH58fD4 G9kDchwfqVefkBwup2uZM+Q4WhJt5jN3AxXCsaS2yXEDuWgS8VOzW0gFjhEPmLyFMKBFaLb1HRwc DiaKwx0EeTMRYnYPQRW3PP4HApvlMv0PttX5v/D6Aws3IOSEwzmLAAAAAElFTkSuQmCC In-Reply-To: (Leo Liu's message of "Wed, 08 May 2013 11:29:33 +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:159420 Archived-At: On 2013-05-08 11:29 +0800, Leo Liu wrote: > It turns out my implementation doesn't modify LIST. So maybe rename it > to ido-remove-consecutive-dups or change the implementation to work > in-place. Missed the case when there is only one element. Patch re-worked as follows. diff --git a/lisp/ido.el b/lisp/ido.el index e335758e..d74733c0 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-remove-consecutive-dups matches))) (defun ido-set-matches () @@ -4729,6 +4727,22 @@ (defun ido-summary-buffers-to-end () ido-temp-list)))) (ido-to-end summaries))) +(defun ido-remove-consecutive-dups (list) + "Remove 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 (and (equal last (car list)) + (cdr result)) + (cdr result) + result)))) + ;;; Helper functions for other programs (put 'dired-do-rename 'ido 'ignore)