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:23:12 +0200 (CEST) Message-ID: <521374123.1041844255.1590618192543.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: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="98390"; 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 00:24:12 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 1je4T6-000PTs-Qu for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 28 May 2020 00:24:12 +0200 Original-Received: from localhost ([::1]:38370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1je4T5-00017v-Jg for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 27 May 2020 18:24:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51400) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1je4Sw-00015w-QP for bug-gnu-emacs@gnu.org; Wed, 27 May 2020 18:24:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38705) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1je4Sw-0000rM-H8 for bug-gnu-emacs@gnu.org; Wed, 27 May 2020 18:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1je4Sw-0003AX-47 for bug-gnu-emacs@gnu.org; Wed, 27 May 2020 18:24: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 22:24: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.159061819712123 (code B ref 41536); Wed, 27 May 2020 22:24:02 +0000 Original-Received: (at 41536) by debbugs.gnu.org; 27 May 2020 22:23:17 +0000 Original-Received: from localhost ([127.0.0.1]:50251 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1je4SC-00039T-Nj for submit@debbugs.gnu.org; Wed, 27 May 2020 18:23:17 -0400 Original-Received: from smtp3-g21.free.fr ([212.27.42.3]:23610) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1je4SA-00039I-6m for 41536@debbugs.gnu.org; Wed, 27 May 2020 18:23:14 -0400 Original-Received: from zimbra39-e7.priv.proxad.net (unknown [172.20.243.189]) by smtp3-g21.free.fr (Postfix) with ESMTP id 8ECB513F89A; Thu, 28 May 2020 00:23:12 +0200 (CEST) In-Reply-To: <857dwxt67f.fsf@gmail.com> 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:181114 Archived-At: ----- Mail original ----- > De: "Noam Postavsky" > =C3=80: ydirson@free.fr > Cc: 41536@debbugs.gnu.org > Envoy=C3=A9: Mercredi 27 Mai 2020 23:32:04 > Objet: Re: bug#41536: uniquify can select non-unique prefix >=20 > ydirson@free.fr writes: >=20 > > 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. >=20 > 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-a= ll 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 curren= t 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 w= as 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 c= ase 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" v= s. 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 lea= ding dirs and take the next" would fit: that would let a/x/b/y/c vs. a/b/c to re= solve as x/c vs. b/c. The idea is that an outer directory is likely to carry mor= e semantic weight. With more than 2 files if ambiguities arise, it is likely acceptable in man= y cases to keep this first dir and recurse. Say we add a/x/t/c to the lot, that wo= uld give x/b/c, x/t/c, and b/c. Does that make any sense to anyone beside me ? Best regards, --=20 Yann