unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Stefan Monnier'" <monnier@iro.umontreal.ca>
Cc: 4654@emacsbugs.donarmstrong.com
Subject: bug#4654: 23.1; Elisp manual doc of abbreviate-file-name
Date: Wed, 7 Oct 2009 00:50:41 -0700	[thread overview]
Message-ID: <0F408BF94DA24CFCB960917D03E903BA@us.oracle.com> (raw)
In-Reply-To: <jwvocojbvxn.fsf-monnier+emacsbugreports@gnu.org>

> > ~/foo/ tells you that foo is directly under the home directory.
> 
> Actually, you can see right there: "~/foo" is longer than "/foo", 

Yes, you already said that once, and I already agreed with it once. Let me agree
with it again: it is one character longer. So it is not strictly an
abbreviation. I cannot argue with that.

However, there is nothing about this function that is necessarily abbreviation.
It is only in a general, average, overall, figurative sense that this function
performs abbreviation.

> 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? 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. ;-) 

(Yes, I said that before too, but it apparently had no effect on your
must-be-shorter argument.)

The point is that unless you want the function to do somthing different in this
regard (home-dir replacement) on different platforms, strictly applying a
criterion of abbreviation in the sense of shortening is not TRT.

In this case (HOME as root) at least, we should decide based on something other
than simply whatever is shorter.

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. 

Neither aspect is always abbreviation in the sense of using something shorter.

IOW, the word "abbreviation" is used wrt this function only in a vague,
suggestive way. It cannot be seen as substitution of something necessarily
shorter. Nit-picking about a string being one-character longer is beside the
point.

> > it's not a toss-up, since the _purpose_ of the function is to use ~.
> 
> No it's not.  The purpose is to abbreviate, i.e. make shorter.

No, it's not. And it cannot be, in general - see above.

The stated purpose of the function is two-fold: (1) substitute a defined alias
(we call it an "abbreviation", but it is not necessarily shorter than what it
replaces), and (2) substitute `~' for the home dir (which is likewise not
necessarily abbreviation in the sense of replacement by something shorter, at
least on Windows).

The substitution we use should have the merits of (a) telling users something
(which is why I pointed out the advantages of both approaches in terms of
providing additional information) and (b) being consistent.

a. Always substituting `~' for the home dir is consistent; and it tells you
where the file is wrt the home dir.

b. Substituting `~' for the home dir except when it is the root dir breaks
consistency; but it does tell you where the file is wrt root (in that one
exceptional case only - otherwise, it tells you where the file is wrt the home
dir). It also has the advantage of legacy: consistency with the past and
existing code.

c. If we were to substitute `~' for the home dir except when that is the root
dir, on UNIX etc., but not substitute it for the home dir when that is the root
dir, on Windows, that would ensure that `~' substitution would always shorten
the file name. But that would introduce additional inconsistency.

And in any case, substituting using `directory-abbrev-alist' does not guarantee
shortening at all. Nothing prevents such "abbreviation" from lengthening the
name.

Overall, (a) is a better choice than (b) or (c) - unless the legacy
consideration has particular importance here for some reason (I don't think it
does).






  reply	other threads:[~2009-10-07  7:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <83ab03mrlo.fsf@gnu.org>
2009-10-06 17:54 ` bug#4654: 23.1; Elisp manual doc of abbreviate-file-name Drew Adams
2009-10-06 20:21   ` Stefan Monnier
2009-10-06 21:12     ` Drew Adams
2009-10-07  5:47       ` Stefan Monnier
2009-10-07  7:50         ` Drew Adams [this message]
2009-10-07 14:09           ` Stefan Monnier
2009-10-07 15:21             ` Drew Adams
2009-10-07 10:30   ` bug#4654: marked as done (23.1; Elisp manual doc of abbreviate-file-name) Emacs bug Tracking System
     [not found] ` <1E8768BDE1464D019FC9EED701E222F4@us.oracle.com>
2009-10-07 17:44   ` bug#4654: 23.1; Elisp manual doc of abbreviate-file-name Eli Zaretskii
2009-10-07 17:55     ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0F408BF94DA24CFCB960917D03E903BA@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=4654@emacsbugs.donarmstrong.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).