* bug#10994: 23.3; ido-mode: ido-next-match / ido-prev-match work wrong with same elements
@ 2012-03-11 12:33 Anonymous
2013-03-19 15:01 ` Leo Liu
0 siblings, 1 reply; 3+ messages in thread
From: Anonymous @ 2012-03-11 12:33 UTC (permalink / raw)
To: 10994
Recipe:
(require 'ido)
(ido-completing-read "dat is whrong -> " '("2" "3" "3" "3" "4" "5"))
Browse this with C-s and C-r. C-s will stuck, C-r will jump to the first occurence of "3".
I've managed to fix this.
In ido-chop:
first, we don't need to choose the first element.
second, we should supply backward-move, to search in reverse. In this way, we find "last" element, as it shold really be.
I did not fix all the functions, that use ido-chop, however. Here is the example with ido-prev-match.
(defun ido-chop (items elem &optional backward-move)
"Remove all elements before ELEM and put them at the end of ITEMS."
(let ((ret nil)
(next nil)
(sofar nil))
(progn
(setq next (car items))
(setq items (cdr items))
(setq sofar (cons next sofar)))
(when backward-move
(setq items (nreverse items)))
(while (not ret)
(setq next (car items))
(if (equal next elem)
(progn
(when backward-move
(setq next (car items))
(setq items (cdr items))
(setq sofar (cons next sofar)))
(setq ret (append items (nreverse sofar))))
;; else
(progn
(setq items (cdr items))
(setq sofar (cons next sofar)))))
(if backward-move (nreverse ret) ret)))
(defun ido-prev-match ()
"Put last element of `ido-matches' at the front of the list."
(interactive)
(if ido-matches
(let ((prev (car (last ido-matches))))
(setq ido-cur-list (ido-chop ido-cur-list prev t))
(setq ido-matches (ido-chop ido-matches prev t))
(setq ido-rescan nil))))
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#10994: 23.3; ido-mode: ido-next-match / ido-prev-match work wrong with same elements
2012-03-11 12:33 bug#10994: 23.3; ido-mode: ido-next-match / ido-prev-match work wrong with same elements Anonymous
@ 2013-03-19 15:01 ` Leo Liu
2013-03-20 3:11 ` Leo Liu
0 siblings, 1 reply; 3+ messages in thread
From: Leo Liu @ 2013-03-19 15:01 UTC (permalink / raw)
To: Anonymous; +Cc: 10994
On 2012-03-11 20:33 +0800, Anonymous wrote:
> (require 'ido)
> (ido-completing-read "dat is whrong -> " '("2" "3" "3" "3" "4" "5"))
Would you be able to give the following patch a though test? Thanks in
advance.
diff --git a/lisp/ido.el b/lisp/ido.el
index 589f4417..6c747124 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -3156,7 +3156,7 @@ (defun ido-chop (items elem)
(sofar nil))
(while (not ret)
(setq next (car items))
- (if (equal next elem)
+ (if (eq next elem)
(setq ret (append items (nreverse sofar)))
;; else
(progn
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#10994: 23.3; ido-mode: ido-next-match / ido-prev-match work wrong with same elements
2013-03-19 15:01 ` Leo Liu
@ 2013-03-20 3:11 ` Leo Liu
0 siblings, 0 replies; 3+ messages in thread
From: Leo Liu @ 2013-03-20 3:11 UTC (permalink / raw)
To: Anonymous; +Cc: 10994-done
Fixed in 24.4.
Patch seems working in my tests. So close the bug.
Leo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-20 3:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-11 12:33 bug#10994: 23.3; ido-mode: ido-next-match / ido-prev-match work wrong with same elements Anonymous
2013-03-19 15:01 ` Leo Liu
2013-03-20 3:11 ` Leo Liu
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).