From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: scratch/backend-completion 9a62da21c2 1/2: Integrate Stefan suggestions but rename it to "external-completion.el" Date: Sat, 3 Dec 2022 23:36:01 +0000 Message-ID: References: <167007345844.23701.8454474119701440468@vcs2.savannah.gnu.org> <20221203131739.2A601C004BA@vcs2.savannah.gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000007301d405eef4eb43" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40814"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Dec 04 00:37:06 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p1c49-000AMi-Fj for ged-emacs-devel@m.gmane-mx.org; Sun, 04 Dec 2022 00:37:05 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p1c3O-00089F-Cf; Sat, 03 Dec 2022 18:36:18 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p1c3N-000883-4M for emacs-devel@gnu.org; Sat, 03 Dec 2022 18:36:17 -0500 Original-Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p1c3K-0004cr-IL for emacs-devel@gnu.org; Sat, 03 Dec 2022 18:36:15 -0500 Original-Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-142b72a728fso9458246fac.9 for ; Sat, 03 Dec 2022 15:36:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=PNgJn3yTMTd91HdrfUOizMZq+hSgtdnQ335x81be+jI=; b=H/lQEbCnaXJw2BkJlkXLlLJh7ohzht/zzpZNGWmEImL8XEreWTD8DW0Y3z0g7BpeUl m3EY3Rpdbk5HbLLrvBYNxE1i1GBkzL/Ax4240MG0Ghu/5eBEoz0Bcad6FtTeENowTQ3G kZF1wQ52+EwBtzUVXwUlJ7FLFMJPsYTrAFwL37RYdEGRNGBX0u45D+wNnwQ+FIt/I7l2 ux0AGLoXGwdNyJrCE8iOgqQVNhbdUU2CdydoOHJmSY0e/gaOvni35QSjxQGZznGFZhMN v5sogQJG/zp8UA3CQDfsxduIJCKun6qL4pRniGv+gqu40xf3r5eLWPCwvC7r3sXhZyCM F7mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PNgJn3yTMTd91HdrfUOizMZq+hSgtdnQ335x81be+jI=; b=op1hIJ0aZQFanXSpXKyni57oAOHHSy3t5xzA3FPXPuJD9qoDpO+TPrNdLA6uIjjmVy L0W1Kk8LVbIJwOOB1ZHkwt/kCoP8GipHpLURZx486ttbm9Smks0FpWtkuduVDKUbHsMm fk25KFojCTLJRZJkPRrVe7M6KfZ7oO3IKab72iMTDuVc0E8wZachsrhkkd2ulQXEBIcU zZSNaNXIW5cuk0dU11qcwOzXz9zgK1TjSyQCADSkiOeGJe58Ev52ZmABevhNAh0fEhXR izNDrnREMlnvsaOB44M1eMZM30qvkSzy79mlXHcv90OE0683p+yvYtojr8J99wuijV1H GpMA== X-Gm-Message-State: ANoB5pkB882q4Jt1vP2O8l7PpHHeT6DSw1Abnkz3rs6bCnTU9TAJb+5q k4DP5OnA3wMzH0jiWAR4edQS5Y2Syg6+l4ulRMI= X-Google-Smtp-Source: AA0mqf5rBpn0CWXlGF15cFRMfnjBBBqZZMGfS4eEpPZcYit8OYSvm+ao9YIjfb6YvzioLmGqtGEbP/Pd5p6Al4r7Sy0= X-Received: by 2002:a05:6871:410e:b0:143:7889:c525 with SMTP id la14-20020a056871410e00b001437889c525mr21830574oab.171.1670110573165; Sat, 03 Dec 2022 15:36:13 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2001:4860:4864:20::33; envelope-from=joaotavora@gmail.com; helo=mail-oa1-x33.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300881 Archived-At: --0000000000007301d405eef4eb43 Content-Type: text/plain; charset="UTF-8" On Sat, Dec 3, 2022 at 2:26 PM Stefan Monnier wrote: > > Integrate Stefan suggestions but rename it to "external-completion.el" > Ha! Great minds thing alike! Nice! > > +(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`? Good idea. Done. > > +(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" :-). Haha. Yes I fixed it. And category is now the first argument, I think it's slightly more logical. > > +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). I'm still confused, I need examples to understand this stuff, and I'm afraid If I do I'll forget all about it next time around. But personally I don't _have_ to understand it, really. Been using this for years successfully without understanding it, so why should I start now? I made the docstring even more cheeky so you can see what I mean. > 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. Good idea. Done. --0000000000007301d405eef4eb43 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sat, Dec 3, 2022 at 2:26 PM Stefan Monnier <monnier@iro.umontreal.ca> wrote= :
> > =C2=A0 =C2=A0 Integrate Stefan suggestions but rename it to = "external-completion.el"
> Ha!=C2=A0 Great minds thing alik= e!

Nice!

> > +(add-to-list 'comp= letion-styles-alist
> > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 '(external-completion-style
>
> This sounds a bit like = the RAS syndrome, just without the acronym.
> Why not use just `exter= nal`?

Good idea. Done.

> > +(d= efun external-completion-table (lookup
> > + =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 category &optional metadata
> > + =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 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 s= econd line, then
> just add a space before "lookup" :-).

Haha.=C2=A0 Yes I fixed it.=C2=A0 And category is no= w the first argument, I think it's
slightly more logical.

> > +TRY-COMPLETION-FUNCTION is an poorly understood imple= mentation detail.
>
> Not at all.=C2=A0 It's a functionalit= y that only makes sense for some UIs
> (not those based on the idea o= f selecting among a set of choices), and
> it tends to work better wi= th more "primitive" completion styles (it
> asymptotically = becomes useless the harder the completion style tries to
> find compl= etions).

I'm still confused, I need examples t= o understand this stuff, and I'm afraid
If I do I'll forg= et all about it next time around. But personally I don't _have_ to=C2= =A0
understand it, really.=C2=A0 Been using this for years succes= sfully without=C2=A0
understanding it, so why=C2=A0should I start= now? I made the docstring=C2=A0
even more cheeky so you can see = what I mean.

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

Good idea. Done.
<= /div> --0000000000007301d405eef4eb43--