bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#4654: 23.1; Elisp manual doc of abbreviate-file-name


From: Stefan Monnier
Subject: bug#4654: 23.1; Elisp manual doc of abbreviate-file-name
Date: Wed, 07 Oct 2009 10:09:12 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

>> so it would be wrong for abbreviate-file-name to do such a 
>> replacement, since it wouldn't abbreviate.
> That's being a bit too black-and-white, don't you think?

Not really.  Clearly abbreviate-file-name does not guarantee that the
returned file name will be shorter.  But it *should* aim to "do no
harm", i.e. not make file names longer (although it doesn't guarantee
that either, IIUC, since it depends on directory-abbrev-alist which is
free to lengthen at the user's heart's content).

> In that case, it is even more "wrong" to return c:\\foo instead of
> ~/foo, which is what we do now on Windows. That's 3 chars longer,
> a threefold worsening of your non-shortening problem. ;-)

No: the relevant question is not "does it make it shorter", but "does
it make it longer".  So it's OK (tho suboptimal) to keep "C:\\foo" as
is, but it's not OK to turn "/foo" into "~/foo".  I wouldn't mind if
someone wants to change that behavior in w32, but I'll leave that to
people who actually care about w32.

> The stated feature of "abbreviation" for this function has two
> aspects: (1) substituting a defined "abbreviation" from
> `directory-abbrev-list' - which is _not_ necessarily shorter than what
> it replaces, in fact, and (2) substituting `~' for the home dir.

I think that's the core of the misunderstanding.  The purpose of
abbreviate-file-name is not to apply the above two steps.  Those steps
are just the current way to reach the real goal, which is to abbreviate the
file name.  Admittedly, "abbreviate" is not exactly meant here as
"shorten" but rather as "make it more concise/easy/pretty for the user",
but still to a first approximation "not longer" is a very good
design guideline.


        Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]