emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fix for bug 10994 breaks ido customizations in major way


From: Leo Liu
Subject: Re: fix for bug 10994 breaks ido customizations in major way
Date: Wed, 08 May 2013 11:10:12 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3)

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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]