From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#66948: [PATCH] Add Completion Preview mode Date: Sun, 05 Nov 2023 18:26:24 +0000 Message-ID: <87lebcqcof.fsf@posteo.net> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8788"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Dmitry Gutov , =?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 Sun Nov 05 19:27:51 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 1qzhqg-00023h-01 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Nov 2023 19:27:50 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qzhqK-0004kY-DA; Sun, 05 Nov 2023 13:27:28 -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 1qzhqH-0004jr-Vf for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2023 13:27: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 1qzhqH-0000uj-Fq for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2023 13:27:25 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qzhqs-00030L-Au for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2023 13:28:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Nov 2023 18:28:02 +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.169920883011472 (code B ref 66948); Sun, 05 Nov 2023 18:28:02 +0000 Original-Received: (at 66948) by debbugs.gnu.org; 5 Nov 2023 18:27:10 +0000 Original-Received: from localhost ([127.0.0.1]:38171 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qzhq2-0002yy-FV for submit@debbugs.gnu.org; Sun, 05 Nov 2023 13:27:10 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:58113) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qzhq0-0002yi-Fi for 66948@debbugs.gnu.org; Sun, 05 Nov 2023 13:27:09 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 43456240028 for <66948@debbugs.gnu.org>; Sun, 5 Nov 2023 19:26:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1699208785; bh=WvXciaIOX260pw0WE1kNoPod0ZhOLVOH0pWMtSnHNPI=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From; b=pkEhJ6jQlnPPZC8YR6UryABy0TKHBKe7GEsG/pzVOBoF6JWM3/8IP0KE8LRHdYWMu YOPgS7ARvuPAD3EshtGOmcXZTqK7/qiHvrKp7her5pzZvgztojTJYxryg+sOV7Qwde VukKV2AXB0PaFyYj4gdUhXevJfRWq4K/q4WVF4F2nGp1nLQdanJuz7EXJkB4JPZ656 76ObCgaNMiVWvnjkzg0ReqtoYNzzvqOkCIwQqhxrfLjrkiWquXC7Qes2oqrdtiOB8u JGUyJqEraVWP0g4Zy5TC+ir1pe7BxTpM1ljZszuBdaT1rtrNjL+uuh75DTiNgtuS2N +K9ouYBL2Ox1w== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4SNjc05V8yz9rxD; Sun, 5 Nov 2023 19:26:24 +0100 (CET) In-Reply-To: (Eshel Yaron's message of "Sun, 05 Nov 2023 11:26:07 +0100") X-Hashcash: 1:20:231105:66948@debbugs.gnu.org::pK5k68/qMH38XaFN:JFI X-Hashcash: 1:20:231105:me@eshelyaron.com::8cOoeSY6UITnqrq2:8Fr X-Hashcash: 1:20:231105:dmitry@gutov.dev::9uyFcMImIbuGoTyb:3jZ4 X-Hashcash: 1:20:231105:joaotavora@gmail.com::NkXusNEUImRFT7th:BV6a Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM 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:273840 Archived-At: Eshel Yaron writes: > Tags: patch > > Following the recent discussion on emacs-devel[0], I'm attaching a patch > that adds a new Completion Preview minor mode. I didn't follow the discussion in detail, but is this related to the capf-autosuggest package? > I've been testing this patch with different completion backends, and so > far I'm pretty happy with the results. I've made some tweaks compared > to the version I posted on emacs-devel to make the implementation more > robust, and in particular to accommodate for some peculiarities of > LSP-based completion, which I've tested mostly with `eglot` but also > with `lsp-mode`. > > In terms of documentation, this patch extends "(emacs)Symbol Completion" > with a description of Completion Preview mode. That seemed like a good > place to discuss this mode, but let me know if somewhere else would be > preferable. > > Another question is whether to have RET/TAB/both accept and insert the > completion suggestion. In VS Code, both RET and TAB do that AFAICT. If > we want to, we can easily do that too by binding RET/TAB in > `completion-preview-active-mode-map`. Alternatively, we can just > suggest doing so in the documentation. The current patch binds neither > RET nor TAB, so to accept the suggestion you complete with C-M-i. > Personally, I find that convenient enough, but I can imagine that many > users might expect TAB or RET to work too. FWIW From a brief test, my main annoyances have been that DEL drops any completion and that there is no option to cycle between inexact completions. > > [0] https://lists.gnu.org/archive/html/emacs-devel/2023-10/msg00693.html > > + (pcase (bounds-of-thing-at-point 'symbol) [...] You can use `pcase-let' here. > + (`(,beg . ,end) > + (<= completion-preview-minimum-symbol-length (- end beg))))) -- Philip Kaludercic