From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#65137: 29.1; completion-substring-try-completion doesn't return the longest common substring Date: Wed, 30 Aug 2023 02:25:41 +0300 Message-ID: <263f9281-67f4-2eea-ef9b-8dfa67740854@gutov.dev> References: <665cd10a-17d9-5586-927e-12b2808c0a71@gutov.dev> 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="17647"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: 65137@debbugs.gnu.org, Stefan Monnier To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 30 01:27:45 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 1qb87Z-0004IZ-IV for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 30 Aug 2023 01:27:42 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qb872-0003ky-8m; Tue, 29 Aug 2023 19:27:11 -0400 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 1qb86p-0003Wl-7T for bug-gnu-emacs@gnu.org; Tue, 29 Aug 2023 19:26:55 -0400 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 1qb86o-0002GY-UM for bug-gnu-emacs@gnu.org; Tue, 29 Aug 2023 19:26:54 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qb86w-0003NW-3Y for bug-gnu-emacs@gnu.org; Tue, 29 Aug 2023 19:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Aug 2023 23:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65137 X-GNU-PR-Package: emacs Original-Received: via spool by 65137-submit@debbugs.gnu.org id=B65137.169335156312918 (code B ref 65137); Tue, 29 Aug 2023 23:27:02 +0000 Original-Received: (at 65137) by debbugs.gnu.org; 29 Aug 2023 23:26:03 +0000 Original-Received: from localhost ([127.0.0.1]:51811 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qb85y-0003MH-M9 for submit@debbugs.gnu.org; Tue, 29 Aug 2023 19:26:03 -0400 Original-Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:57991) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qb85v-0003Ll-4G for 65137@debbugs.gnu.org; Tue, 29 Aug 2023 19:26:00 -0400 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 7407F3200939; Tue, 29 Aug 2023 19:25:44 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 29 Aug 2023 19:25:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1693351543; x=1693437943; bh=KQ1U11brztIKlL9ugG186IQrc44ceKuNEei DvWmpFuI=; b=VejtZOToCl4J3BMMma5aqyuxdLbfJ1mcxiRlUjjMXl07cQC4/xd 9ebmJrOg90ax7bLqVGD2Y4onnjkpSJUGzXk9HftRI9tdkB7WRk/IDbL8+KXV5Pk3 NEv2Hp2cro+VZOTNiefI95N9at5VIFWq3v+2XMY9etSfItlcGg9wWvI6gP365IVu x8NohI8K6s3P9fYh0ore83krhVMpGcT90XaMicUhNk0mGraW7KQzhLVB/bSZ0A5g 4UI5fNWKwyYb7WsIZ0OmZD+vyf8WcJI4H91Dh8S23XRtInwQ0q1DPcH3rM9Vs04G yPfA9HFpXvjdpxB5ZUmnJhHLu+0wB9F9LbQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1693351543; x=1693437943; bh=KQ1U11brztIKlL9ugG186IQrc44ceKuNEei DvWmpFuI=; b=l1LKyF+rsDdbcXJdHwn1YevVOH63D46sWrNweWMANlPD+WDIozk gw3tj9bpRkBALu4OAxGvTtR51ulatP66nGKQJcE/YVtgujBlMSpC9EEKTLp4Gjtk relPHDWgJ4NwSvbOL+qazWtIaEYfsbOlxEjnVeoaJWjuLjRJwfMXMDVOT+A4i2ah n63usEcdpYRJNr/TDGNa1b8zOjWA1JB+weKgr9fmSsC2+fXpPJbrdIBeiCCsTdwt +JNkJOs94S/NXkwRcFrYUFVdGp0nNYDdGR/fZpvuZBru3Pu3GIYirmMn8BIkD06H HSjYZnVXXM+2yRpqJI7/tHJYPLJ7v7hQ/2A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudefjedgudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 29 Aug 2023 19:25:42 -0400 (EDT) Content-Language: en-US In-Reply-To: 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:268682 Archived-At: On 29/08/2023 18:45, Spencer Baugh wrote: >> Could you describe the usage scenario a little more? >> >> From my brief testing, the current behavior seems okay most of the >> time: you still get the short input which matches a bunch of strings >> (e.g. filenames), you can type a little more chars and narrow down. >> >> With your change, TAB will insert the most common prefix for all those >> completions, which in case of project-file can be a pretty long >> string. Not a huge problem, but on the face of it that doesn't seem >> like an improvement. So which scenario would that make better? > > As a very concrete example that I ran into frequently, for > project-find-file if you have two files: > > dir/foo.ml > dir/foo.mli > > and you input "foo" and press Tab, you get "foo.ml". But it is then > impossible to expand that to dir/foo.ml using completion because of this > bug. So you have to manually select dir/foo.ml if you want to visit > that file, either by switching to *Completions* and selecting it or by > using minibuffer-next-completion. Now I understand, thank you. I guess this is something that certain environments (such as OCaml) are more prone to than others. Also this problem seems somewhat unique to the default completion mechanism. If I use Ivy, or Helm, or Vertico, or even the "bare" icomplete-mode, they all have the notion of the currently selected completion, with a short key sequence to choose it. E.g. with icomplete-mode on I would type until the needed completion is highlighted in the minibuffer and then press C-j (maybe press C-, or C-. to select it). The default completion, as you say, has the means to do a similar thing with M- and M-, but it's less obvious and requires more keypresses. > After this bugfix, inputting "foo" and pressing Tab will expand to > "dir/foo.ml". > > In general, this bug makes it impossible to input a file name with > completion (in project-file) if that file name is a prefix of another > file name. Like dir/foo and dir/foo.tar, or dir/foo.log and > dir/foo.log.bak. Your patch fixes that by expanding inputs into longer lines after TAB (meaning, the user will see their input text shift, sometimes considerably, to the right, and perhaps feel a little disoriented). It might be a minor thing, but a downside nevertheless. I do wonder what Stefan thinks what would be the right behavior here.