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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 10994 in the body.
You can then email your comments to 10994 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#10994; Package emacs. (Sun, 11 Mar 2012 20:10:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Anonymous <desu <at> horishniy.org.ua>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 11 Mar 2012 20:10:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

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))))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10994; Package emacs. (Tue, 19 Mar 2013 15:04:02 GMT) Full text and rfc822 format available.

Message #8 received at 10994 <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Anonymous <desu <at> horishniy.org.ua>
Cc: 10994 <at> debbugs.gnu.org
Subject: Re: bug#10994: 23.3;
	ido-mode: ido-next-match / ido-prev-match work wrong with same
	elements
Date: Tue, 19 Mar 2013 23:01:06 +0800
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




Reply sent to Leo Liu <sdl.web <at> gmail.com>:
You have taken responsibility. (Wed, 20 Mar 2013 03:14:02 GMT) Full text and rfc822 format available.

Notification sent to Anonymous <desu <at> horishniy.org.ua>:
bug acknowledged by developer. (Wed, 20 Mar 2013 03:14:02 GMT) Full text and rfc822 format available.

Message #13 received at 10994-done <at> debbugs.gnu.org (full text, mbox):

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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 17 Apr 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 11 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.