emacs-devel
[Top][All Lists]
Advanced

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

Re: scratch/backend-completion 9a62da21c2 1/2: Integrate Stefan suggesti


From: Stefan Monnier
Subject: Re: scratch/backend-completion 9a62da21c2 1/2: Integrate Stefan suggestions but rename it to "external-completion.el"
Date: Sat, 03 Dec 2022 09:26:36 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

>     Integrate Stefan suggestions but rename it to "external-completion.el"

Ha!  Great minds thing alike!

> +(add-to-list 'completion-styles-alist
> +             '(external-completion-style

This sounds a bit like the RAS syndrome, just without the acronym.
Why not use just `external`?

> +(defun external-completion-table (lookup
> +                                 category &optional metadata
> +                                 try-completion-function)

Ah, I see you made tryc optional :-)
I'd put `category` on the first line, tho.
If you don't like the resulting indentation of the second line, then
just add a space before "lookup" :-).

> +TRY-COMPLETION-FUNCTION is an poorly understood implementation detail.

Not at all.  It's a functionality that only makes sense for some UIs
(not those based on the idea of selecting among a set of choices), and
it tends to work better with more "primitive" completion styles (it
asymptotically becomes useless the harder the completion style tries to
find completions).

The goal of "try completion" is, given STRING and POINT, to return
the longest string COMPLETION (together with a NEWPOINT) such that
(allc STRING POINT) = (allc COMPLETION NEWPOINT).

> +(defun external-completion--try-completion (string table pred point)
> +  (external-completion--call 'external-completion-tryc string table pred 
> point))

AFAICT the `external-completion-tryc/allc` symbols are not exposed to
users of this library any more so we could use ones with a double hyphen.


        Stefan




reply via email to

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