From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#65137: 29.1; completion-substring-try-completion doesn't return the longest common substring Date: Tue, 29 Aug 2023 11:45:37 -0400 Message-ID: References: <665cd10a-17d9-5586-927e-12b2808c0a71@gutov.dev> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26034"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 65137@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 29 17:46:40 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 1qb0vP-0006V5-Fq for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 29 Aug 2023 17:46:39 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qb0v3-0006mg-H9; Tue, 29 Aug 2023 11:46:17 -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 1qb0ul-0006kC-JM for bug-gnu-emacs@gnu.org; Tue, 29 Aug 2023 11:46:00 -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 1qb0uh-0004bd-IS for bug-gnu-emacs@gnu.org; Tue, 29 Aug 2023 11:45:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qb0uo-00033s-3r for bug-gnu-emacs@gnu.org; Tue, 29 Aug 2023 11:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Aug 2023 15:46: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.169332395311752 (code B ref 65137); Tue, 29 Aug 2023 15:46:02 +0000 Original-Received: (at 65137) by debbugs.gnu.org; 29 Aug 2023 15:45:53 +0000 Original-Received: from localhost ([127.0.0.1]:51401 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qb0ue-00033U-RQ for submit@debbugs.gnu.org; Tue, 29 Aug 2023 11:45:53 -0400 Original-Received: from mxout6.mail.janestreet.com ([64.215.233.21]:43103) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qb0uc-00033H-MF for 65137@debbugs.gnu.org; Tue, 29 Aug 2023 11:45:51 -0400 In-Reply-To: <665cd10a-17d9-5586-927e-12b2808c0a71@gutov.dev> (Dmitry Gutov's message of "Fri, 25 Aug 2023 03:40:43 +0300") 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:268663 Archived-At: Dmitry Gutov writes: > Hi Spencer! > > On 08/08/2023 02:24, Spencer Baugh wrote: >> However, even this does not work in the project-file and xref-location >> completion categories, for which the "basic" style is not included in >> completion-category-defaults. For such completion categories, there's >> simply no way to use completion to insert a common prefix. This is bad, >> because a filename or identifier might easily be a prefix of another >> filename or identifier. > > 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. 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.