GNU bug report logs - #10994
23.3; ido-mode: ido-next-match / ido-prev-match work wrong with same elements

Previous Next

Package: emacs;

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

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Leo Liu <sdl.web <at> gmail.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#10994: closed (23.3; ido-mode: ido-next-match /
 ido-prev-match work wrong with same elements)
Date: Wed, 20 Mar 2013 03:14:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Wed, 20 Mar 2013 11:11:27 +0800
with message-id <m11ubasr34.fsf <at> gmail.com>
and subject line Re: bug#10994: 23.3; ido-mode: ido-next-match / ido-prev-match work wrong with same elements
has caused the debbugs.gnu.org bug report #10994,
regarding 23.3; ido-mode: ido-next-match / ido-prev-match work wrong with same elements
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
10994: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10994
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Anonymous <desu <at> horishniy.org.ua>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.3; ido-mode: ido-next-match / ido-prev-match work wrong with same
	elements
Date: Sun, 11 Mar 2012 14:33:48 +0200
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))))


[Message part 3 (message/rfc822, inline)]
From: Leo Liu <sdl.web <at> gmail.com>
To: Anonymous <desu <at> horishniy.org.ua>
Cc: 10994-done <at> debbugs.gnu.org
Subject: Re: bug#10994: 23.3;
	ido-mode: ido-next-match / ido-prev-match work wrong with same
	elements
Date: Wed, 20 Mar 2013 11:11:27 +0800
Fixed in 24.4.

Patch seems working in my tests. So close the bug.

Leo


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.