[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, reada
From: |
Drew Adams |
Subject: |
RE: Null filename ("") is considered to correspond to an existing, readable, and writable file? |
Date: |
Tue, 3 Jan 2006 00:25:03 -0800 |
> Besides, where is the section of the manual that says that,
> unless stated otherwise, all file-name arguments to functions
> are relative
This is a basic notion of every filesystem: every file is relative to
the current directory, unless it begins with the root directory
string. I don't thing the Emacs manual should teach such basics.
That every file is relative to its directory is not the question. You guys
are adamant, but in contradictory ways.
To support the "obviousness" that all file-name arguments to all functions
are relative file names (which cannot be true, BTW), you provide the
platitude that all files are relative to their directory. Luc is adamant
that this file-name argument need _not_ be a relative file name.
Experiment shows that Luc is right on this one. But you make my point: the
doc for this function says nothing about its file-name argument, so it's
anyone's guess - try it and see...
> and they are all relative to the `default-directory'?
In Emacs, `default-directory' is the variable that stores the current
directory that is in effect when you are in that file's buffer. The
Emacs manual says in the node "File Names":
Of course a file is relative to its directory. I know what
`default-directory' is.
Each buffer has a default directory which is normally
the same as the directory of the file visited in that buffer.
When you enter a file name without a directory, the default
directory is used. If you specify a directory in a relative
fashion, with a name that does not start with a slash, it is
interpreted with respect to the default directory. The
default directory is kept in the variable `default-directory', which
has a separate value in every buffer.
Clear enough?
Perfect. That paragraph, as you point out, is from the Emacs manual, not the
Elisp manual. It is about _entering_ file names in response to prompts. What
you enter is not necessarily what the function uses as an argument. The
paragraph is not about file-name arguments to Emacs-Lisp functions. And it
says only that relative file names are taken relative to the default
directory. It does not speak at all to the question at hand.
> Beyond the doc, wouldn't you expect functions with these
> names to return nil for a "" argument? What's the purpose
> of not checking this case, correctly
> applying the meaning of the function's name and returning nil?
>
> Is it so that you can use (file-exists-p "") to test the existence of
> directory `default-directory'? What's the advantage of such a
> "feature"?
> There are other, more readable ways to test that: (file-exists-p
> default-directory), for instance.
>
> Sorry, I still don't get it. Why is the design like this?
This was discussed here some months ago, although I couldn't find that
thread in the few minutes I had to look for it.
I already said that I assumed this was "by design". I asked what the design
_advantage_ is. No answer, so far.
Anyway, the design is as it is. My point was that the arguments to these
functions should be documented more clearly - in particular, the case of a
"filename" of "" should be mentioned - especially given the names of these
functions.
- 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, 2006/01/02
- 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 <=
- 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
- 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?, Drew Adams, 2006/01/03
- Re: Null filename ("") is considered to correspond to an existing, readable, and writable file?, Thien-Thi Nguyen, 2006/01/07
- 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