-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix and improve sorting full matches first under some conditions. (#149)
- Let `prescient-filter-regexps` return flat list of regexps. We need to be able to test the individual regexps produced by the filter methods to see if they fully match. If we use the `or`-ed combined regexps, which we use for filtering, then it's possible for Emacs to only find a matching substring using a partially matching sub-regexp before testing the fully matching sub-regexp, depending on the order in which the sub-regexps are `or`-ed together. - Change the property list to use normal keys. - Change `prescient-regexps` to `:prescient-match-regexps`. - Add `:prescient-all-regexps`, which we need for proper sorting. - Test the each regexp produced by a filter method separately. Do not just re-use the regexps that were used for filtering. Do not assume that all of the tested regexps will match the candidates. - Fix `prefix` with `:with-group` when the first character of the query is a word character. Make sure to not accidentally match the middle of a word. - Tweak the `prefix` filter method to better work with `prescient-sort-full-matches-first` and avoid conflicts when trying to use an initialism. Don't use greedy matching when there are no non-word characters. 1. "re" only matches "re" at the start of the word "repeat", not the entire word. Otherwise, we run into conflicts when we want "re" to be an initialism for a longer command name, such as "restart-emacs". 2. ".g" fully matches ".git". 3. "s-r" fully matches "string-rectangle", not just "string-r". This can't conflict with `initialism`, so there is no harm in assuming that the "r" is meant to match an entire word, just like the "s" does.
- Loading branch information
Showing
3 changed files
with
181 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters