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

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

Re: file-readable-p returns t for empty string


From: David Kastrup
Subject: Re: file-readable-p returns t for empty string
Date: 28 Feb 2002 17:35:22 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50

address@hidden (Eli Zaretskii) writes:

> On 28 Feb 2002, David Kastrup wrote:
> 
> > > See file-name-absolute-p.  It says that in Emacs, a file name is absolute 
> > > if it satisfies one of these conditions:
> > > 
> > >   - begins with a directory separator (normally `/')
> > > 
> > >   - begins with a `~'
> > > 
> > >   - on DOS/Windows systems begins with a drive letter
> > 
> > Well, I doubt we have many programs that do the equivalent of
> > (while (not (file-name-absolute-p file))
> >         (setq file (expand-file-name file)))
> 
> I don't know; there are more than 50 uses of that primitive in the 
> bundled packages, and many of them do use expand-file-name right after 
> that.
> 
> Anyway, I just wanted to answer the (implied) question about what is 
> considered an absolute file name in Emacs, to the effect that there is 
> already a definition.  If that definition should now include "", we will 
> have to make sure it doesn't break something important.

The question would be what semantics about a file name being absolute
file-name-absolute-p should be checking for, and what semantics about
a file name being absolute expand-file-name should provide, and
whether those are necessarily the same.  Currently the online docs of
file-name-absolute-p are as vague as can be about it: they just state
something by example, and also say that this example is only valid
for Unix systems.

For expand-file-name, I guess the wanted semantics are definitely
clearer: here it would be desirable that the resulting file name gets
independent from any particular setting of the current working
directory.  Expanding "" to "" makes sense in that case.

While it would be the logical thing then to make
(file-name-absolute-p "") return t, the question is whether it would
be the expected thing, or at least whether somebody might have relied
on it to return something different.  I would guess not, since
file-name-absolute-p does not give any guarantees that a file name is
legal (it would have to check in the file system for that), merely
that it is not relative.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Email: address@hidden



reply via email to

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