From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#66948: [PATCH] Add Completion Preview mode Date: Tue, 07 Nov 2023 09:08:07 +0200 Organization: LINKOV.NET Message-ID: <86y1faf56w.fsf@mail.linkov.net> References: <87lebcqcof.fsf@posteo.net> <86a5rrcqd3.fsf@mail.linkov.net> <86zfzqeoix.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28976"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: Dmitry Gutov , Philip Kaludercic , =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , 66948@debbugs.gnu.org To: Eshel Yaron Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 07 08:23:17 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1r0GQd-0007Ms-60 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 07 Nov 2023 08:23:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r0GPL-0003zQ-Te; Tue, 07 Nov 2023 02:21:59 -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 1r0GOr-00032Q-8u for bug-gnu-emacs@gnu.org; Tue, 07 Nov 2023 02:21:26 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0GOq-0003Et-9r for bug-gnu-emacs@gnu.org; Tue, 07 Nov 2023 02:21:25 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r0GPR-0008LQ-SH for bug-gnu-emacs@gnu.org; Tue, 07 Nov 2023 02:22:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Nov 2023 07:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66948 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 66948-submit@debbugs.gnu.org id=B66948.169934171532063 (code B ref 66948); Tue, 07 Nov 2023 07:22:01 +0000 Original-Received: (at 66948) by debbugs.gnu.org; 7 Nov 2023 07:21:55 +0000 Original-Received: from localhost ([127.0.0.1]:41205 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0GPK-0008L5-TJ for submit@debbugs.gnu.org; Tue, 07 Nov 2023 02:21:55 -0500 Original-Received: from relay7-d.mail.gandi.net ([217.70.183.200]:46299) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0GPJ-0008Kr-94 for 66948@debbugs.gnu.org; Tue, 07 Nov 2023 02:21:53 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 1E0D320003; Tue, 7 Nov 2023 07:21:06 +0000 (UTC) In-Reply-To: (Eshel Yaron's message of "Mon, 06 Nov 2023 20:47:34 +0100") X-GND-Sasl: juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:273913 Archived-At: >> Only one thing that I suggest is to add `backward-delete-char-untabify` >> to `completion-preview-commands` since it's bound to DEL in Lisp buffers. >> Or there is no way to generalize it for all modes? > > I too wonder if there's a good generalization we can make here. It > seems impractical and inelegant to track all backward-deleting commands > in `completion-preview-commands`. We could try to check if a command > was invoked by pressing DEL, regardless of what command it actually is, > but I don't think that's such a good solution because of course the DEL > key itself is not the point--we want to recognize `delete-backward-char` > even if it's bound to some other key, for example. We have exactly the same problem while developing a live update of the *Completions* window while typing in the minibuffer. Here too DEL needs to update the completions. But this works as long as the users don't rebind the DEL key. Therefore currently a list of commands is used as well. > The current solution, of providing a minimal list of commands in > `completion-preview-commands`, basically delegates the decision of which > further commands should keep the preview alive to major mode authors and > to the users themselves. I think that's basically fine, but if we had > some way to recognize backward-deleting commands without hard-coding > them (perhaps a symbol property such as `delete-backward-command`) that > would be even better IMO. Agreed, it's easy to customize commands deemed to be important for the user. Until we will find a way to remove such a list altogether. One possible solution is to rely on the hook: (add-hook 'after-change-functions (lambda (beg end len) (when (and (= beg end) (= len 1)) ...)) nil t) But this should be developed separately, then later integrated into completion-preview.