unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Cc: "João Távora" <joaotavora@gmail.com>
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	[thread overview]
Message-ID: <jwvwn781sss.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20221203131739.2A601C004BA@vcs2.savannah.gnu.org> ("João	Távora"'s message of "Sat,  3 Dec 2022 08:17:39 -0500 (EST)")

>     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




  parent reply	other threads:[~2022-12-03 14:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <167007345844.23701.8454474119701440468@vcs2.savannah.gnu.org>
     [not found] ` <20221203131739.3FCF9C004BE@vcs2.savannah.gnu.org>
2022-12-03 14:10   ` scratch/backend-completion aaaa016056 2/2: Speed it up Stefan Monnier
2022-12-03 23:30     ` João Távora
2022-12-04  0:18       ` Stefan Monnier
2022-12-04 11:11         ` João Távora
     [not found] ` <20221203131739.2A601C004BA@vcs2.savannah.gnu.org>
2022-12-03 14:26   ` Stefan Monnier [this message]
2022-12-03 23:36     ` scratch/backend-completion 9a62da21c2 1/2: Integrate Stefan suggestions but rename it to "external-completion.el" João Távora
2022-12-04  0:31       ` Stefan Monnier
2022-12-04 10:02         ` João Távora
2022-12-04 16:54           ` Stefan Monnier
2022-12-04 20:04             ` João Távora
2022-12-06  0:14               ` Stefan Monnier
2022-12-07 11:09                 ` João Távora
2022-12-07 13:56                   ` Eli Zaretskii
2022-12-07 19:09                     ` João Távora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvwn781sss.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=joaotavora@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).