lewang / flx

Fuzzy matching for Emacs ... a la Sublime Text.
GNU General Public License v3.0
518 stars 37 forks source link

flx-ido breaks ido-mode buffers sort order #100

Closed Hi-Angel closed 5 years ago

Hi-Angel commented 5 years ago

Original ido-mode has a nice feature: it shows most recently visited buffers first. I'd expect the flx-ido-mode to just add a fuzzy match, but retain the original sorting. Unfortunately it doesn't, which often results in even more typing than without flx-ido-mode.

Steps to reproduce

  1. Use this in .emacs to initialize ido-mode
    (require 'flx-ido)
    (ido-mode)
    (flx-ido-mode)
  2. "Open" a new empty buffer named main.rs.awesome
  3. "Open" a new empty buffer named main.rs.way-cooler
  4. Switch to *scratch* buffer
  5. Press C-x+b to get a list of buffers (note that the list has main.rs.way-cooler as the first match).
  6. Type main

Expected

main.rs.way-cooler should be the first match as it's the most recently visited.

Actual

main.rs.awesome becomes the first element in the list.

oscarfv commented 5 years ago

flx assigns a score to each candidate and then sorts based on that score. Usually, each candidate ends with a different score. In this context, your proposal is incompatible with how flx-ido works.

Hi-Angel commented 5 years ago

@oscarfv okay, is there a way to disable that sorting then?

Hi-Angel commented 5 years ago

Cool, I just found in someone's blog post: turns out, that functional exists in vanilla ido without any addons, just use:

(setq ido-enable-flex-matching t)

Closing then.

oscarfv commented 5 years ago

flex-matching is a different method of selecting and sorting candidates. I'm glad it does what you want, though.

jdtsmith commented 3 years ago

The place where I have the most trouble with this is imenu-anywhere, which prioritizes matches in the current buffer over other buffers. flx-ido unfortunately overrides this sort behavior, which means the function you're usually after is down the list. Would be great to have a configurable list of commands for flx-ido to preserve the sort order of.

oscarfv commented 3 years ago

The place where I have the most trouble with this is imenu-anywhere, which prioritizes matches in the current buffer over other buffers. flx-ido unfortunately overrides this sort behavior, which means the function you're usually after is down the list. Would be great to have a configurable list of commands for flx-ido to preserve the sort order of.

flx-ido is all about sorting. If you change the sorting, it is not flx anymore. You can disable flx-ido locally advising the function (i.e. imenu-everywhere).