lewang / flx

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

prefer buffer name and case sensitive matches #83

Closed fommil closed 8 years ago

fommil commented 8 years ago

I just ran into a situation where I wanted to view a buffer called TaskTimings.scala, so I typed C-x b then Tas.

I expected the open buffer to be selected as the default, but the preference was the TAGS file, which contained a reference to TaskTimings.scala (which I assume was detected).

At the time of the completion, my minibuffer looked like this:

Buffer: Tas[kTimings.scala]{ TAGS | TaskTimings.scala }

Are there any current options to deal with this?

Some ideas:

  1. give stronger weighting to exact capitalisation matches
  2. give stronger weighting to buffer/file names rather than in-buffer matches (I'm assuming it is matching within the TAGS buffer because the Tas is completed fully)
fommil commented 8 years ago

my complete config https://github.com/fommil/dotfiles/blob/master/.emacs.d/init.el#L239-L249

fommil commented 8 years ago

since reporting, I discovered

(setq
  ido-case-fold nil
  ido-ignore-buffers '("TAGS*"))

which is a suitable workaround for this particular incident. but ido-case-fold seems to be ignored (I'm still getting case insensitive hits).

PythonNut commented 8 years ago

This is strange.

So we would expect TaskTimings.scala to be preferred even without strict case sensitivity.

Give stronger weighting to buffer/file names rather than in-buffer matches (I'm assuming it is matching within the TAGS buffer because the Tas is completed fully)

flx-ido does not check for in-buffer matches. Tas matches TAGS in the following way: Tags.

Are you sure you understand how fuzzy matching works? If you wanted to match TaskTimings.scala, a better query would be tts.

ido-case-fold seems to be ignored

Indeed, the lack of custimization is detailed here.

fommil commented 8 years ago

interesting. So why is the completion like this

Buffer: Tas[kTimings.scala]{ TAGS | TaskTimings.scala }

showing that Tas[kTimings.scala] is detected in both cases? (or is that not what it means)

fommil commented 8 years ago

and, huh, if those are the scores (and I confirm I get the same scores) why is the TAGS showing up first? Did I accidentally select it previously or something?

PythonNut commented 8 years ago

@fommil I don't know, as I don't use ido. I do know flx does not take your history into account. What happens when you press RET?