GNU bug report logs - #41536
uniquify can select non-unique prefix

Previous Next

Package: emacs;

Reported by: ydirson <at> free.fr

Date: Tue, 26 May 2020 12:57:02 UTC

Severity: wishlist

Found in version 26.3

To reply to this bug, email your comments to 41536 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#41536; Package emacs. (Tue, 26 May 2020 12:57:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to ydirson <at> free.fr:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 26 May 2020 12:57:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: ydirson <at> free.fr
To: submit <at> debbugs.gnu.org
Subject: uniquify can select non-unique prefix
Date: Tue, 26 May 2020 14:56:50 +0200 (CEST)
Package: emacs
Version: 26.3

After openning the following two files:

 /tmp/a/b/c
 /tmp/a/x/b/y/c

With style "forward" and all other customization vars as "standard",
the buffer names are respectively:

 b/c
 y/c

With my source-directory layout respecting the "higher-level is most significant"
principle, I would have expected the second buffer to be "x/b/c" instead.

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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41536; Package emacs. (Wed, 27 May 2020 21:33:02 GMT) Full text and rfc822 format available.

Message #8 received at 41536 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: ydirson <at> free.fr
Cc: 41536 <at> debbugs.gnu.org
Subject: Re: bug#41536: uniquify can select non-unique prefix
Date: Wed, 27 May 2020 17:32:04 -0400
ydirson <at> free.fr writes:

> 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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41536; Package emacs. (Wed, 27 May 2020 22:24:02 GMT) Full text and rfc822 format available.

Message #11 received at 41536 <at> debbugs.gnu.org (full text, mbox):

From: ydirson <at> free.fr
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 41536 <at> debbugs.gnu.org
Subject: Re: bug#41536: uniquify can select non-unique prefix
Date: Thu, 28 May 2020 00:23:12 +0200 (CEST)

----- Mail original -----
> De: "Noam Postavsky" <npostavs <at> gmail.com>
> À: ydirson <at> free.fr
> Cc: 41536 <at> debbugs.gnu.org
> Envoyé: Mercredi 27 Mai 2020 23:32:04
> Objet: Re: bug#41536: uniquify can select non-unique prefix
> 
> ydirson <at> free.fr writes:
> 
> > 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.

Does that make any sense to anyone beside me ?

Best regards,
-- 
Yann




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41536; Package emacs. (Wed, 27 May 2020 23:00:02 GMT) Full text and rfc822 format available.

Message #14 received at 41536 <at> debbugs.gnu.org (full text, mbox):

From: ydirson <at> free.fr
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 41536 <at> debbugs.gnu.org
Subject: Re: bug#41536: uniquify can select non-unique prefix
Date: Thu, 28 May 2020 00:58:58 +0200 (CEST)
> > 
> > > 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




Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Tue, 25 Aug 2020 13:50:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 295 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.