[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Null filename ("") is considered to correspond to an existing, read
From: |
Luc Teirlinck |
Subject: |
Re: Null filename ("") is considered to correspond to an existing, readable, and writable file? |
Date: |
Mon, 2 Jan 2006 22:41:51 -0600 (CST) |
Drew Adams wrote:
Fine. It should be documented. There are plenty of functions that take an
absolute file-name argument, and others that take a relative file-name
argument. The doc for these particular functions should say that the
argument must be a relative file name.
No, it does _not_ have to be a relative file name. It is _allowed_ to
be. If you do not want a relative file name, then why do you specify
one? Just start your filename with ~ or /. The _normal_ situation is
that both are accepted. It are the exceptions that should be documented.
And they should explicitly point out the case of "". All the more so because
their names can easily mislead you into thinking that an argument of "" will
return a nil result.
Why do you absolutely want to create files with the empty string as
name? It does not work, at least not on POSIX systems. Does it work
on MS Windows?
Besides, where is the section of the manual that says that, unless stated
otherwise, all file-name arguments to functions are relative, and they are
all relative to the `default-directory'?
They are _not_ relative unless the docstring states otherwise. They
are relative unless the file name specifies otherwise, that is, if the
file name starts with / or ~. "" does not start with / or ~, hence it
is relative. Read `(elisp)Relative File Names'.
Yes, of course it does. So what? It talks about lists and faces too, but
that doesn't mean that the doc for a function shouldn't specify what its
arguments are.
But a function taking lists or faces as arguments should not explain
what lists and faces are.
Beyond the doc, wouldn't you expect functions with these names to return nil
for a "" argument?
Of course not. If default-directory is "/mydir/", then "a" is the
file "/mydir/a", the concatenation of /mydir/" and "a". Why would
you expect "" to be anything else but "/mydir/", the concatenation of
"/mydir/ and "" ?.
Is it so that you can use (file-exists-p "") to test the existence of
directory `default-directory'?
Of course.
What's the advantage of such a "feature"?
That it makes sense and is consistent.
Why is the design like this?
Because it is logical and consistent. And it is POSIX's design, not Emacs'.
Sincerely,
Luc.
- Null filename ("") is considered to correspond to an existing, readable, and writable file?, Drew Adams, 2006/01/02
- Re: Null filename ("") is considered to correspond to an existing, readable, and writable file?, Luc Teirlinck, 2006/01/02
- RE: Null filename ("") is considered to correspond to an existing, readable, and writable file?, Drew Adams, 2006/01/02
- Re: Null filename ("") is considered to correspond to an existing, readable, and writable file?,
Luc Teirlinck <=
- RE: Null filename ("") is considered to correspond to an existing, readable, and writable file?, Drew Adams, 2006/01/03
- Re: Null filename ("") is considered to correspond to an existing, readable, and writable file?, Eli Zaretskii, 2006/01/03
- Re: Null filename ("") is considered to correspond to an existing, readable, and writable file?, Luc Teirlinck, 2006/01/03
- Re: Null filename ("") is considered to correspond to an existing, readable, and writable file?, Eli Zaretskii, 2006/01/03
- RE: Null filename ("") is considered to correspond to an existing, readable, and writable file?, Drew Adams, 2006/01/03
- Re: Null filename ("") is considered to correspond to an existing, readable, and writable file?, Stefan Monnier, 2006/01/03
- RE: Null filename ("") is considered to correspond to an existing, readable, and writable file?, Drew Adams, 2006/01/03
- Re: Null filename ("") is considered to correspond to an existing, readable, and writable file?, Eli Zaretskii, 2006/01/03
- RE: Null filename ("") is considered to correspond to an existing, readable, and writable file?, Drew Adams, 2006/01/03
- Re: Null filename ("") is considered to correspond to an existing, readable, and writable file?, Luc Teirlinck, 2006/01/03