all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Leo <sdl.web@gmail.com>
To: Antoine Levitt <smeuuh@gmail.com>
Cc: 2042@debbugs.gnu.org
Subject: bug#2042: Ido-mode : filtering does not keep ordering
Date: Sun, 25 Sep 2011 00:20:27 +0800	[thread overview]
Message-ID: <m1d3ep29pw.fsf@gmail.com> (raw)
In-Reply-To: <6fa54e4e0901250554q1519cba5t83df1577e2cbc132@mail.gmail.com> (Antoine Levitt's message of "Sun, 25 Jan 2009 14:54:28 +0100")

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)
 
 ;;; FIND MATCHING ITEMS
 
-(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 "\$\\'" rex0))
-			 (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)
 			     ido-enable-prefix
 			     (= (length ido-text) 0)))
-	 full-matches suffix-matches prefix-matches matches)
+	 matches)
     (setq ido-incomplete-regexp nil)
     (condition-case error
         (mapc
@@ -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))))))
 	   t)
          items)
@@ -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)
 	       ido-enable-flex-matching
 	       (> (length ido-text) 1)





  reply	other threads:[~2011-09-24 16:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-25 13:54 bug#2042: Ido-mode : filtering does not keep ordering Antoine Levitt
2011-09-24 16:20 ` Leo [this message]
2011-09-25  8:54   ` Antoine Levitt
2011-10-01 19:10   ` Chong Yidong
2011-10-02  0:04     ` Leo
2011-10-29  6:38       ` Chong Yidong
2011-10-29  7:06         ` Leo
2012-09-16  9:29         ` Matthew Woodcraft
2012-09-16 14:55           ` Leo
2012-09-16 15:03             ` Leo
2012-09-16 16:33               ` Chong Yidong
2012-09-16 22:28 ` Leo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1d3ep29pw.fsf@gmail.com \
    --to=sdl.web@gmail.com \
    --cc=2042@debbugs.gnu.org \
    --cc=smeuuh@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.