Skip to content

prescient.el 5.1

Compare
Choose a tag to compare
@raxod502 raxod502 released this 27 Feb 06:02

Enhancements

  • Literal-prefix matching, a new filter method whose behavior is that the first subquery must be the prefix of the candidate and the remaining subqueries must be prefixes of words in the candidate. Supports char folding just like literal.

    For example, if the input is foo bar, then the candidate must begin with foo, and it must also contain a word starting with bar. That means it would match foo-and-bar or fooboo-barquux but not bar-foo (because that doesn't start with foo) or foo-qbar (because bar is no prefix of some word).

    It can be enabled by adding literal-prefix to prescient-filter-method.

  • Anchored matching, a new filtering method that uses uppercase letters and symbols as beginning of word, similar to initialism. It can be enabled by adding anchored to prescient-filter-method.

    For example TTL matches toogle-truncate-lines and FiAPo or fiAPo match both find-file-at-point and find-function-at-point. However fiFiAPo matches only the former and fiFuAPo matches only the latter. See #70 and #76.

  • Prefix matching, a new filtering method similar to the Emacs completion style partial, was added. It can be enabled by adding prefix to prescient-filter-method.

    As is the case in partial completion, t-t-l matches toggle-truncate-lines and fi--a-po matches find-file-at-point, find-function-at-point, and other similarly named symbols. One difference is that you can't use * as a wildcard (it is instead taken literally), since you can achieve the same effect by separating queries with a space. See #67 and #76.

  • Literal matching now supports char folding making Unicode text filtering much easier (#66).

  • In selectrum-prescient.el, commands were added for toggling the
    active filtering methods in the Selectrum buffer. See #72.

    • This toggling is a buffer-local effect, and doesn't change the default behavior (determined by prescient-filter-method).

    • With a prefix argument, a command unconditionally toggles on its respective filtering method and toggles off all others.

    • While selectrum-prescient-mode is enabled, M-s is bound to selectrum-prescient-toggle-map in the Selectrum buffer, and is used as a prefix key to access the commands. The macro selectrum-prescient-create-and-bind-toggle-command can be used to create a toggling command for a filter, and bind that command in selectrum-prescient-toggle-map.

      Key Command
      M-s a selectrum-prescient-toggle-anchored
      M-s f selectrum-prescient-toggle-fuzzy
      M-s i selectrum-prescient-toggle-initialism
      M-s l selectrum-prescient-toggle-literal
      M-s p selectrum-prescient-toggle-prefix
      M-s r selectrum-prescient-toggle-regexp
  • The user option prescient-filter-alist was added, which describes the relationship between the symbols in prescient-filter-list and the corresponding functions that produce regular expressions for matching candidates. Users can create their own filter methods by adding a symbol-function pair to prescient-filter-alist and use that custom method by adding the symbol to prescient-filter-method. See #77.

    The functions that produce the regexps used for searching candidates are now considered public. They are

    • prescient-anchored-regexp
    • prescient-fuzzy-regexp
    • prescient-initials-regexp
    • prescient-literal-regexp
    • prescient-prefix-regexp
    • prescient-regexp-regexp
    • prescient-with-group