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: [PATCH] (icomplete-vertical-mode): Add support for affixations and, annotations Date: Mon, 24 May 2021 12:34:36 +0200 Message-ID: References: <87zgwlb4xc.fsf@gmail.com> <87eedxrqz4.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11551"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= , emacs-devel@gnu.org To: Stefan Monnier , Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon May 24 12:35:51 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 1ll7w7-0002mC-IL for ged-emacs-devel@m.gmane-mx.org; Mon, 24 May 2021 12:35:51 +0200 Original-Received: from localhost ([::1]:52432 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ll7w6-0002Cl-Km for ged-emacs-devel@m.gmane-mx.org; Mon, 24 May 2021 06:35:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ll7v0-0000kt-Ix for emacs-devel@gnu.org; Mon, 24 May 2021 06:34:43 -0400 Original-Received: from server.qxqx.de ([2a01:4f8:121:346::180]:46047 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 1ll7uy-0006Z9-Mb for emacs-devel@gnu.org; Mon, 24 May 2021 06:34:42 -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=JDXS6aAuNSY0D4ILavEg8c50D8LN0FHgcwr4B+qSBFA=; b=NEsMXSwqpkAHH5ki0Pg9KCJvay 6jo09Iac+T6JjfNMyLedOAJ8CWVIuu61Z3rCraC2EOYQ0xkHLanxX4QfsFdv4nUWq3PtZv/eO8RD2 T60aNTlmiv/0HdlA0I/mrCVVs9l79CPuue/1Z3Fklq7O9k692eT7QkEBqGh7AcYRfmqw=; 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:269745 Archived-At: On 5/24/21 5:23 AM, Stefan Monnier wrote: >>> I also don't understand why :affixation-function is given a full list of >>> completions, when it is presumably meant to return a list of exactly the >>> same length. >> >> This has the advantage in functions like read-extended-command--affixation, >> where minibuffer-selected-window is selected only once with with-selected-window, >> then all completions are processed in the same buffer, without the need >> to switch buffers for every completion in a long list, as annotation-function >> would require to do. > > Why does the function use `with-selected-window`? I can't see why it > would need to mess with windows. As for switching buffer, the only > reason I can see to switch buffer is for `where-is-internal`, which > could be fixed by pre-computing the set of keymaps (see patch below) > which also makes sure we use the right buffer whereas > `minibuffer-selected-window` could theoretically return another active > minibuffer than "ours". That is of course correct that it is better to add some internal pre-computation. In the case of Marginalia we also have an extra caching for the keybindings, since the `where-is-internal` function is relatively slow. This matters when computing the keybinding annotations on many candidates. The context in which the `annotation/affixation-function` is computed is not entirely clear across the set of available completion UIs, but it is mostly the minibuffer. The solutions used in the various annotation/affixation functions which are around are not a clean technical solution but rather some best effort to show something useful and hopefully correct in many scenarios. The most extensive use case are probably our Marginalia package and the comparable ivy-rich package (Note that ivy-rich does not make use of Ivy-specific infrastructure). Daniel