From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: ydirson@free.fr Newsgroups: gmane.emacs.bugs Subject: bug#41536: uniquify can select non-unique prefix Date: Thu, 28 May 2020 00:58:58 +0200 (CEST) Message-ID: <908011962.1041896177.1590620338618.JavaMail.root@zimbra39-e7> References: <1422112800.1035313346.1590497810370.JavaMail.root@zimbra39-e7> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="117563"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 41536@debbugs.gnu.org To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 28 01:00:22 2020 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 1je526-000USh-77 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 28 May 2020 01:00:22 +0200 Original-Received: from localhost ([::1]:47600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1je524-0007D9-Vq for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 27 May 2020 19:00:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1je51m-0007D1-Ky for bug-gnu-emacs@gnu.org; Wed, 27 May 2020 19:00:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38759) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1je51m-000568-81 for bug-gnu-emacs@gnu.org; Wed, 27 May 2020 19:00:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1je51m-00043Z-53 for bug-gnu-emacs@gnu.org; Wed, 27 May 2020 19:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: ydirson@free.fr Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 May 2020 23:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41536 X-GNU-PR-Package: emacs Original-Received: via spool by 41536-submit@debbugs.gnu.org id=B41536.159062034315502 (code B ref 41536); Wed, 27 May 2020 23:00:02 +0000 Original-Received: (at 41536) by debbugs.gnu.org; 27 May 2020 22:59:03 +0000 Original-Received: from localhost ([127.0.0.1]:50305 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1je50o-00041x-Ir for submit@debbugs.gnu.org; Wed, 27 May 2020 18:59:02 -0400 Original-Received: from smtp6-g21.free.fr ([212.27.42.6]:44594) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1je50m-00041X-6K for 41536@debbugs.gnu.org; Wed, 27 May 2020 18:59:00 -0400 Original-Received: from zimbra39-e7.priv.proxad.net (unknown [172.20.243.189]) by smtp6-g21.free.fr (Postfix) with ESMTP id 9F4DE7802FE; Thu, 28 May 2020 00:58:58 +0200 (CEST) In-Reply-To: <521374123.1041844255.1590618192543.JavaMail.root@zimbra39-e7> X-Originating-IP: [91.170.159.152] X-Mailer: Zimbra 7.2.0-GA2598 (ZimbraWebClient - FF3.0 (Linux)/7.2.0-GA2598) X-Authenticated-User: ydirson@free.fr 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" Xref: news.gmane.io gmane.emacs.bugs:181116 Archived-At: > > > > > In my case the "y" level is even a python package for modules > > > containing abstract > > > classes, call it "lib" -- you'll understand that "lib/foo.py" is > > > not really > > > helpful, when other packages could have a module of the same name > > > in a "lib/" > > > subpackage. > > > > I agree this can be annoying in many cases, but how do you expect > > Emacs > > to know which directory names should be considered? Have a > > backlist > > of > > "too generic" words like "lib", "utils", "config", etc? > > No, I'd rather using a couple of rules, but I do agree finding a > one-fits-all > heuristic is likely hard to get. Let me think aloud a bit, in the > hope it will > stir ideas from others as well. > > (by the way, I did not look at the code yet, getting the gist of the > current heuristic > will be obviously useful) > > My initial thought when seeing a/x/b/y/c vs. a/b/c resolved as y/c vs > b/c was > something like "never select a dirname for one buffer if it exists > for all". > Obviously that formulation is not sufficient, as it would not handle > the a/b/c vs. > b/a/c case, but maybe but as a work approximation we can leave the > latter case > for later rule refining if needed.. > > That rule would result, for my a/x/b/y/c vs. a/b/c case, in > "(x/)?(y/)?c" vs. just "c". > That could be an option, although arguably the "c" part does appear > in both paths and > we don't want strip it. > > When only 2 files are at hand, maybe a heuristic like "strip all > common leading > dirs and take the next" would fit: that would let a/x/b/y/c vs. a/b/c > to resolve > as x/c vs. b/c. The idea is that an outer directory is likely to > carry more semantic > weight. > > With more than 2 files if ambiguities arise, it is likely acceptable > in many cases > to keep this first dir and recurse. Say we add a/x/t/c to the lot, > that would give > x/b/c, x/t/c, and b/c. For the record, another case where the current heuristic is wrong for me: projname/b/c/d vs. projname/a/b/c/d. It is currently resolved as "projname/d" vs. "a/d", presumably by removing all common _suffix_ until a diff is found, whereas with a heuristic of removing all common _prefix_ it would have settled with "b/d" vs. "a/d", which would have made much more sense. Hope this can clarify further :) -- Yann