emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r112512: Re-work a fix for bug#10994


From: Leo Liu
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112512: Re-work a fix for bug#10994 based on Le Wang's patch.
Date: Wed, 08 May 2013 22:22:24 +0800
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 112512
fixes bug: http://debbugs.gnu.org/10994
author: Leo Liu <address@hidden>, Le Wang <address@hidden>
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Wed 2013-05-08 22:22:24 +0800
message:
  Re-work a fix for bug#10994 based on Le Wang's patch.
  * ido.el (ido-remove-consecutive-dups): New helper. 
  (ido-completing-read): Use it.
  (ido-chop): Revert fix for bug#10994.
modified:
  lisp/ChangeLog
  lisp/ido.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-05-08 06:59:41 +0000
+++ b/lisp/ChangeLog    2013-05-08 14:22:24 +0000
@@ -1,3 +1,10 @@
+2013-05-08  Leo Liu  <address@hidden>
+
+       Re-work a fix for bug#10994 based on Le Wang's patch.
+       * ido.el (ido-remove-consecutive-dups): New helper.
+       (ido-completing-read): Use it.
+       (ido-chop): Revert fix for bug#10994.
+
 2013-05-08  Adam Spiers  <address@hidden>
 
        * cus-edit.el (custom-save-variables):

=== modified file 'lisp/ido.el'
--- a/lisp/ido.el       2013-04-05 14:00:08 +0000
+++ b/lisp/ido.el       2013-05-08 14:22:24 +0000
@@ -3152,15 +3152,13 @@
     (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
@@ -4678,6 +4676,21 @@
                              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 (or (and (equal last (car list))
+                      (cdr result))
+                 result))))
+
 ;;; Helper functions for other programs
 
 (put 'dired-do-rename 'ido 'ignore)
@@ -4795,7 +4808,7 @@
        (ido-directory-nonreadable nil)
        (ido-directory-too-big nil)
        (ido-context-switch-command 'ignore)
-       (ido-choice-list choices))
+       (ido-choice-list (ido-remove-consecutive-dups choices)))
     ;; Initialize ido before invoking ido-read-internal
     (ido-common-initialization)
     (ido-read-internal 'list prompt hist def require-match initial-input)))


reply via email to

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