emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : Re: Stepping Back: A Wealth Of Completion systems Re: [


From: Drew Adams
Subject: RE: [External] : Re: Stepping Back: A Wealth Of Completion systems Re: [ELPA] New package: vertico
Date: Wed, 7 Apr 2021 18:13:26 +0000

> Regarding predicates, there is an idea how this could be
> integrated with completion. One can implement a completion
> style which support a filter language, depending on the
> completion category. The completion style can then execute
> the filter predicates on the corresponding objects. However
> such an approach certainly takes it a bit far as completion
> styles are concerned.
>
> I think Icicles offers options to filter within completion
> based on predicates?

I've avoided chiming in on this discussion, which
I think, so far, is a bit reductive and simplistic.

Icicles provides (and I hope other completion
frameworks do too) lots of other, related, features
that aren't covered by the categories raised so far
(including the S.I.F.T categories in T.V. Raman's
interesting blog post:
https://emacspeak.blogspot.com/2018/06/).

But I'll speak to your last sentence.  Yes, Icicles
lets you provide predicates on the fly, to further
filter completion candidates.

(Of course, Emacs completion has always used
predicates.  This is instead about users providing
predicates interactively, on the fly, to narrow a
set of candidates.)

You can progressively provide both additional match
patterns and additional predicates.  To add another
match pattern you use `S-SPC'.  To add another
predicate you use `C-u S-SPC'.

I call this process of completion by successive
approximation, or progressively narrowing the
candidate set, "progressive completion".  (`S-SPC'
and similar have `narrow' in their command names.)

You could instead call it "incremental completion",
aka icompletion, but that term was taken long ago
by Icomplete for something much more limited.

To provide a predicate to apply on the fly, you type
its name or a lambda-expression for it.

Completion (lax) is available for this predicate input,
against known predicates for the particular kind of
candidates - e.g., buffer-name predicates for buffer-name
completion.

You can customize the predicates available for a given
completion TYPE with options `icicle-cand-preds-for-TYPE'.

If you provide a prefix arg to the underlying command
for predicate completion, then all predicates from a
different option, `icicle-cand-preds-all', are available.

Predefined `icicle-cand-preds-for-TYPE':

 icicle-cand-preds-for-bookmark
 icicle-cand-preds-for-buffer
 icicle-cand-preds-for-color
 icicle-cand-preds-for-face
 icicle-cand-preds-for-file
 icicle-cand-preds-for-frame
 icicle-cand-preds-for-misc
 icicle-cand-preds-for-package
 icicle-cand-preds-for-symbol
 icicle-cand-preds-for-variable
 icicle-cand-preds-for-window

To compose a lambda expression, you can use any keys
in `icicle-read-expression-map' that don't conflict
with completion keys.  (Since `TAB' conflicts, you can
use `C-M-i' or `ESC tab' to complete a Lisp symbol.)

You can use `C-M-&' (`icicle-save-predicate-to-variable')
during completion to save the current predicate (all
predicates composed so far) as a string-valued variable.

You can retrieve the saved string later, using `C-='
at the prompt for a predicate. You can thus build up
a complex predicate, and save it for later use.

The inconvenience of typing an Emacs-Lisp sexp is
balanced against the power of applying predicates on
the fly.  Pattern (regexp, fuzzy, whatever) matching
is purely syntactic, but a predicate can perform
semantic tests.

During search, for instance, you can look not only
for a syntax match; you can also limit candidates to
a particular class of objects (function, variable,
type...) or that satisfy some other semantic property.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]