From: Leo Liu <sdl.web@gmail.com>
To: Le Wang <l26wang@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: fix for bug 10994 breaks ido customizations in major way
Date: Wed, 08 May 2013 12:49:53 +0800 [thread overview]
Message-ID: <m1ehdiaxe6.fsf@gmail.com> (raw)
In-Reply-To: <m14nee6teq.fsf@gmail.com> (Leo Liu's message of "Wed, 08 May 2013 11:29:33 +0800")
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)
next prev parent reply other threads:[~2013-05-08 4:49 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-02 17:57 fix for bug 10994 breaks ido customizations in major way Le Wang
2013-05-03 4:13 ` Leo Liu
2013-05-03 12:49 ` Le Wang
2013-05-03 20:33 ` Leo Liu
2013-05-04 7:00 ` Le Wang
2013-05-04 8:58 ` Óscar Fuentes
2013-05-04 13:00 ` Le Wang
2013-05-05 10:57 ` Óscar Fuentes
2013-05-05 11:39 ` Leo Liu
2013-05-05 12:20 ` Óscar Fuentes
2013-05-05 12:58 ` Leo Liu
2013-05-05 13:38 ` Óscar Fuentes
2013-05-05 14:31 ` Stephen J. Turnbull
2013-05-05 15:26 ` Óscar Fuentes
2013-05-06 15:11 ` Le Wang
2013-05-06 22:49 ` Vitalie Spinu
2013-05-07 1:01 ` Óscar Fuentes
2013-05-07 9:35 ` Le Wang
2013-05-07 10:26 ` Vitalie Spinu
2013-05-07 10:35 ` Óscar Fuentes
2013-05-07 14:49 ` Le Wang
2013-05-07 21:18 ` Stefan Monnier
2013-05-07 14:42 ` Le Wang
2013-05-07 14:44 ` Drew Adams
2013-05-07 14:47 ` Le Wang
2013-05-07 19:00 ` Vitalie Spinu
2013-05-07 19:53 ` Óscar Fuentes
2013-05-08 0:04 ` Leo Liu
2013-05-08 0:35 ` Le Wang
2013-05-08 3:10 ` Leo Liu
2013-05-08 3:29 ` Leo Liu
2013-05-08 4:49 ` Leo Liu [this message]
2013-05-08 8:14 ` Vitalie Spinu
2013-05-08 8:42 ` Leo Liu
2013-05-08 12:23 ` Le Wang
2013-05-08 14:29 ` Leo Liu
2013-05-08 20:56 ` Juri Linkov
2013-05-10 1:52 ` Leo Liu
2013-05-17 2:48 ` Leo Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1ehdiaxe6.fsf@gmail.com \
--to=sdl.web@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=l26wang@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).