GNU bug report logs -
#10994
23.3; ido-mode: ido-next-match / ido-prev-match work wrong with same elements
Previous Next
Reported by: Anonymous <desu <at> horishniy.org.ua>
Date: Sun, 11 Mar 2012 20:10:02 UTC
Severity: normal
Found in version 23.3
Done: Leo Liu <sdl.web <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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))))
This bug report was last modified 12 years and 66 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.