From: Luc Teirlinck <teirllm@dms.auburn.edu>
Cc: emacs-devel@gnu.org
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) [thread overview]
Message-ID: <200601030441.k034fpG26165@raven.dms.auburn.edu> (raw)
In-Reply-To: <DNEMKBNJBGPAOPIJOOICKEAIDBAA.drew.adams@oracle.com>
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.
next prev parent reply other threads:[~2006-01-03 4:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-02 22:57 Null filename ("") is considered to correspond to an existing, readable, and writable file? Drew Adams
2006-01-03 1:22 ` Luc Teirlinck
2006-01-03 3:27 ` Drew Adams
2006-01-03 4:41 ` Luc Teirlinck [this message]
2006-01-03 8:24 ` Drew Adams
2006-01-03 18:13 ` Eli Zaretskii
2006-01-03 4:56 ` Luc Teirlinck
2006-01-03 5:32 ` Eli Zaretskii
2006-01-03 8:25 ` Drew Adams
2006-01-03 15:50 ` Stefan Monnier
2006-01-03 18:51 ` Drew Adams
2006-01-03 19:16 ` Eli Zaretskii
2006-01-03 19:25 ` Drew Adams
2006-01-03 19:40 ` Luc Teirlinck
2006-01-03 20:23 ` Luc Teirlinck
2006-01-03 21:09 ` Drew Adams
2006-01-07 20:04 ` Thien-Thi Nguyen
2006-01-03 18:11 ` Eli Zaretskii
2006-01-03 18:51 ` Drew Adams
2006-01-03 19:13 ` Eli Zaretskii
2006-01-03 19:23 ` Drew Adams
2006-01-03 18:51 ` 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=200601030441.k034fpG26165@raven.dms.auburn.edu \
--to=teirllm@dms.auburn.edu \
--cc=emacs-devel@gnu.org \
/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).