From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#66948: [PATCH] Add Completion Preview mode Date: Wed, 08 Nov 2023 10:14:23 +0100 Message-ID: References: <87lebcqcof.fsf@posteo.net> <86a5rrcqd3.fsf@mail.linkov.net> <86zfzqeoix.fsf@mail.linkov.net> <86msvobtjm.fsf@mail.linkov.net> Reply-To: Eshel Yaron Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14243"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Dmitry Gutov , Philip Kaludercic , =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , 66948@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 08 10:16:10 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 1r0efQ-0003SH-FK for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 08 Nov 2023 10:16:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r0ef4-0006Ij-Bv; Wed, 08 Nov 2023 04:15:46 -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 1r0eeq-0006Cl-F7 for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 04:15:37 -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 1r0eei-0003vK-NW for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 04:15:25 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r0efK-0002j3-LF for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 04:16:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eshel Yaron Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Nov 2023 09:16: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.169943490710400 (code B ref 66948); Wed, 08 Nov 2023 09:16:02 +0000 Original-Received: (at 66948) by debbugs.gnu.org; 8 Nov 2023 09:15:07 +0000 Original-Received: from localhost ([127.0.0.1]:43990 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0eeQ-0002hf-K9 for submit@debbugs.gnu.org; Wed, 08 Nov 2023 04:15:06 -0500 Original-Received: from mail.eshelyaron.com ([107.175.124.16]:50900 helo=eshelyaron.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0eeO-0002hX-Ha for 66948@debbugs.gnu.org; Wed, 08 Nov 2023 04:15:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1699434865; bh=G/kGdh5X8edr995uWDP/0JrJoSD2XRPVieIXRQdUJ9Y=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=LQjHRqy5j1kCj3lQlFBPxUEBdiL5In4Y7yDUPf6/C0PmUgeIK6IWDEetAMaJDYnQJ unW+4XilCgqkkFd3jugqGzeEfm4N6IuIgFdSInt9mJSKw1CRTna6ykgp9kg3Vh3v86 67xtjsxF2AFmZcQyV+gJpQwOThTRyKBd0FGa3yopZ+ZFUAWLzzxRF98J6ef2eOfv9G UMyerwyfaXVglzU13HDzZCtFSXu1bg7dG4iQaLzyI43Rfg3UAC7e/OEYEmQ4NnKzPd Duna7OUFDjfM+WGCS9OPA4W8j9WpB0KrtdTvToUOZ5QL9Ja+BdaERJycUB5KZwZYrn qVuW3sejVb/5Q== In-Reply-To: <86msvobtjm.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 08 Nov 2023 09:30:13 +0200") 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:273975 Archived-At: Hi Juri, Juri Linkov writes: > While testing more, I noticed one strange thing, > I don't know if it's intended to work this way. This is not intended, thanks for raising it! Essentially, this is a problem with the default `completion-in-region-function` that I wasn't aware of (: > Typing in *scratch* e.g. > > (message-f TAB > > completes to > > (message-forward > > Then typing > > (message-f M-C-i > At this point, `completion-in-region-mode` is enabled. That's fine. > stops at > > (message-fo > For some reason, `completion-in-region-mode` remains active at point! This means that `completion-in-region-mode-map` stays in effect, and that binds TAB to `completion-at-point`, overriding the our binding for `completion-preview-insert` (and any other binding TAB might have, for that matter). > Then trying again the same as in the first test case > > (message-f TAB > > now stops at the same too > > (message-fo > > whereas the overlay suggests the complete name `message-forward`. Since TAB is bound to `completion-at-point` at this point, you get the same result as you did when you pressed `C-M-i` beforehand. If you would instead say `M-x completion-preview-insert` explicitly, you should get the expected `message-forward`. This appears to be a general problem with `completion-in-region-mode`, that it keeps TAB bound to `completion-at-point` after a partial completion, so I don't think we should attempt to handle it in `completion-preview` specifically. Consider the following scenario, with no `completion-preview-mode` in play: --8<---------------cut here---------------start------------->8--- (defun foo () bar-!- --8<---------------cut here---------------end--------------->8--- Here -!- designates point. If you type TAB right away, `bar` gets indented as expected. But if you first say `C-M-i`, the text stays the same but now TAB is bound to `completion-at-point`, so pressing TAB no longer indents and just says "No match" instead :(