Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight matching substrings when ido-enable-flex-matching is set #45

Open
mardukbp opened this issue Apr 18, 2017 · 2 comments
Open
Labels

Comments

@mardukbp
Copy link

A typical query with flex matching may contain strings separated by spaces and ido-vertical-completions does not handle this case.

My quick-and-dirty solution was to add this:

In let*

(query (split-string name " "))
(nquery (length query))

In the loop that sets the face of the matching substring:

(dotimes (j nquery)
  (let ((query-j (nth j query)))
    (when (string-match (if ido-enable-regexp query-j (regexp-quote query-j)) comps-i)
      (ignore-errors
	(add-face-text-property (match-beginning 0)
				(match-end 0)
				'ido-vertical-match-face
				nil comps-i)))))
@creichert creichert added the bug label Apr 19, 2017
@creichert
Copy link
Owner

creichert commented Apr 19, 2017

Nice, I agree this would be nice to support. Are you interested in trying to improve the solution and make a PR?

@mardukbp
Copy link
Author

mardukbp commented Aug 3, 2017

After three months, this has worked great for me. But I forgot to say that I also modified ido-set-matches-1 so that it only matches consecutive characters. For example, if my query is are, I do not want ido to match algol rapid ego.

What improvements would you suggest? If I had time, I would rewrite ido-mode.el and merge ido-vertical-mode. I think the code in ido-mode.el is very hard to understand and some things are hard-coded that should be customizable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants