[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#2042: Ido-mode : filtering does not keep ordering

From: Leo
Subject: bug#2042: Ido-mode : filtering does not keep ordering
Date: Sun, 25 Sep 2011 00:20:27 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3.50 (Mac OS X 10.6.8)

On 2009-01-25 21:54 +0800, Antoine Levitt wrote:
> Hi,
> When buffer switching in Ido, filtering the list of available buffers does
> not keep the original ordering of buffers (from most recent to oldest).
> Ie if I have for instance buffers foobar and barfoo, in this order, if I
> type bar, they are displayed to me as barfoo foobar. I understand this is a
> reasonable behavior in a number of case, but it's annoying when using ido to
> quickly toggle between working buffers, where I have old and forgotten
> buffers pop up as the first option in the completion list. Would it be
> possible to add a switch ?
> Antoine Levitt

I occasionally try iswitch-mode and find its buffer switching much more
pleasant to use than ido's. The trouble is ido tries to be smart in
ordering matches. Sadly that gets in the way most of the time.

I wonder if people are willing to try the following (preliminary) patch
and see if they miss anything.

diff --git a/lisp/ido.el b/lisp/ido.el
index aa6ad4aa..e0640eba 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -3735,7 +3735,7 @@ (defun ido-get-bufname (win)
-(defun ido-set-matches-1 (items &optional do-full)
+(defun ido-set-matches-1 (items &optional ignore)
   ;; Return list of matches in items
   (let* ((case-fold-search  ido-case-fold)
         (slash (and (not ido-enable-prefix) (ido-final-slash ido-text)))
@@ -3743,18 +3743,11 @@ (defun ido-set-matches-1 (items &optional do-full)
         (rex0 (if ido-enable-regexp text (regexp-quote text)))
         (rexq (concat rex0 (if slash ".*/" "")))
         (re (if ido-enable-prefix (concat "\\`" rexq) rexq))
-        (full-re (and do-full (not ido-enable-regexp) (not (string-match 
"\$\\'" rex0))
-                      (concat "\\`" rex0 (if slash "/" "") "\\'")))
-        (suffix-re (and do-full slash
-                        (not ido-enable-regexp) (not (string-match "\$\\'" 
-                        (concat rex0 "/\\'")))
-        (prefix-re (and full-re (not ido-enable-prefix)
-                        (concat "\\`" rexq)))
         (non-prefix-dot (or (not ido-enable-dot-prefix)
                             (not ido-process-ignore-lists)
                             (= (length ido-text) 0)))
-        full-matches suffix-matches prefix-matches matches)
+        matches)
     (setq ido-incomplete-regexp nil)
     (condition-case error
@@ -3771,12 +3764,6 @@ (defun ido-set-matches-1 (items &optional do-full)
                            (not (string= name ido-default-item)))
                        (string= name (buffer-name ido-entry-buffer)))
                   (setq matches (cons item matches)))
-                 ((and full-re (string-match full-re name))
-                  (setq full-matches (cons item full-matches)))
-                 ((and suffix-re (string-match suffix-re name))
-                  (setq suffix-matches (cons item suffix-matches)))
-                 ((and prefix-re (string-match prefix-re name))
-                  (setq prefix-matches (cons item prefix-matches)))
                  (t (setq matches (cons item matches))))))
@@ -3786,16 +3773,6 @@ (defun ido-set-matches-1 (items &optional do-full)
              ;; special-case single match, and handle appropriately
              ;; elsewhere.
              matches (cdr error))))
-    (when prefix-matches
-      (ido-trace "prefix match" prefix-matches)
-      ;; Bug#2042.
-      (setq matches (nconc prefix-matches matches)))
-    (when suffix-matches
-      (ido-trace "suffix match" (list text suffix-re suffix-matches))
-      (setq matches (nconc suffix-matches matches)))
-    (when full-matches
-      (ido-trace "full match" (list text full-re full-matches))
-      (setq matches (nconc full-matches matches)))
     (when (and (null matches)
               (> (length ido-text) 1)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]