From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Mendler Newsgroups: gmane.emacs.devel Subject: Re: Stepping Back: A Wealth Of Completion systems Re: [ELPA] New package: vertico Date: Wed, 7 Apr 2021 18:32:59 +0200 Message-ID: <4604b887-5c8a-c7c8-70b7-282dbbe9a778@daniel-mendler.de> References: <9c9af088-580f-9fb1-4d79-237a74ce605c@inventati.org> <874kgkxxs0.fsf@posteo.net> <3ec7e2e58a100426a22e@heytings.org> <877dleb2px.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35591"; 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 Wed Apr 07 18:33:56 2021 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 1lUB7s-00099T-4V for ged-emacs-devel@m.gmane-mx.org; Wed, 07 Apr 2021 18:33:56 +0200 Original-Received: from localhost ([::1]:50258 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lUB7r-0006dB-5y for ged-emacs-devel@m.gmane-mx.org; Wed, 07 Apr 2021 12:33:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUB78-0005fr-W4 for emacs-devel@gnu.org; Wed, 07 Apr 2021 12:33:11 -0400 Original-Received: from server.qxqx.de ([2a01:4f8:121:346::180]:44697 helo=mail.qxqx.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUB72-0007fJ-Qd for emacs-devel@gnu.org; Wed, 07 Apr 2021 12:33:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qxqx.de; s=mail1392553390; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=hShb/nrrKjWMafv9q46BsTS/MZEH3D1jtkVKuHDSoyM=; b=dSg63zEIOhpcpMVCczGXTsW1F+ VHKbS942PXZ2xHCUCHRnc6PaLZVaRbCy9ZFfPnqEdYT1V0HfWdWZ5tvAPoYL44JCVlK7zRQ923U75 LNZuW7OT8vPvoBnKKzjz6QiZ6Wt5J7TNAUmW3DhUJbisaPzwbZAn6MpJJ/jxDbq4L8OU=; In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=2a01:4f8:121:346::180; envelope-from=mail@daniel-mendler.de; helo=mail.qxqx.de X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-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.23 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" Xref: news.gmane.io gmane.emacs.devel:267534 Archived-At: On 4/7/21 6:14 PM, Stefan Monnier wrote: >> I wonder how all these use cases could be unified under a common >> API. I would certainly not want to lose the current fast, flat selection >> mechanism via completion as offered by `completing-read'. > > Maybe we could add methods to completion tables that return the set of > "characteristics" that can be used to filter, others that list the set > of possible values of those characteristics, etc... This sounds like a good idea too. In the context of the Orderless completion style we discussed some alternative, which is backward compatible but which bents the definition of a completion style a bit. In Orderless each token is used separately for filtering and the order of the tokens does not matter, e.g., "regexp1 regexp2 regexp3". The idea was to add some special character as token prefix to allow filtering by metadata/characteristics, e.g., if one filters buffers one could write "@elisp", where the string "elisp" is not matched against the candidate string but against some kind of metadata string. The metadata would be supplied by an extra function registered for the completion category. Your approach is certainly more direct. What I like about the idea of registering such a metadata supplier separately is that it allows to enhance completion tables afterwards, even if you are not the author of the completion table. There exist a few packages enhancing existing completion tables by associating some functionality via the completion category: * Marginalia (https://github.com/minad/marginalia) adds annotation/affixation functions * Embark (https://github.com/oantolin/embark) adds minibuffer actions, similar to Ivy actions But in the context of Emacs itself this approach is probably less interesting, maybe except for decoupling some concerns in the code base.