From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel 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 Message-ID: References: <167007345844.23701.8454474119701440468@vcs2.savannah.gnu.org> <20221203131739.2A601C004BA@vcs2.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15498"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: =?windows-1252?B?Sm/jbyBU4XZvcmE=?= To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 03 15:27:30 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 1p1TUI-0003th-Bi for ged-emacs-devel@m.gmane-mx.org; Sat, 03 Dec 2022 15:27:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p1TTe-0006l6-HQ; Sat, 03 Dec 2022 09:26:50 -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 1p1TTb-0006km-9e for emacs-devel@gnu.org; Sat, 03 Dec 2022 09:26:47 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p1TTZ-0006Ub-6y for emacs-devel@gnu.org; Sat, 03 Dec 2022 09:26:46 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 80707440F1F; Sat, 3 Dec 2022 09:26:43 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id C0E174409DF; Sat, 3 Dec 2022 09:26:37 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1670077597; bh=KxsxzH6uANSU2xZMxs0K0/CJz01To9GwLVY+CVbujk8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=hCPlkreaqIA7Z8Ew7FwL0gs+LCfFGnaQPsDCnVPmGIbpvrrzA9gVXeiEZIA9DSUw7 fPuRZY0OzjZ+NuEs/xKsfiwieRVLtwcM6+hK0iQBqkBJHHnoiP9IkAimwU0mYDvyl8 3MZ8FgRACOxCTPGEsKspOjsNWfpCVoSOpvknTwQyoj9hZKfNAxuxW5Nr9DT0n4CnG7 RDr81S2+KNDYyJ0V072XE1o5DJYAQvfiG3TkX62UliS9pEC5sbf4DzB5nYfZW596eq 8qHZRb+vybXJkT7ppnSk/b/XvpITqMwe+BQipLEi9oGyG+8gQs8lLZC/3fvQYeJAQt LuIwzSbQPVd4w== Original-Received: from pastel (unknown [45.72.193.52]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 83C7012256B; Sat, 3 Dec 2022 09:26:37 -0500 (EST) In-Reply-To: <20221203131739.2A601C004BA@vcs2.savannah.gnu.org> (=?windows-1252?Q?=22Jo=E3o=09T=E1vora=22's?= message of "Sat, 3 Dec 2022 08:17:39 -0500 (EST)") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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:300871 Archived-At: > 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