emacs-devel
[Top][All Lists]
Advanced

[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 19:22:57 -0600 (CST)

Drew Adams wrote:

   The following expressions all return true (on Windows, at least). I imagine
   that this is by design (it is an old policy), but I don't understand the
   reason for this.

    (file-exists-p "")
    (file-readable-p "")
    (file-writable-p "")

   How often would someone want a null filename to be considered to correspond
   to an existing, readable, or writable file?

The empty string is a relative file name.  It is the current
directory, given be the buffer-local variable default-directory.  Just
do `M-: (find-file "").  There can not be any file with a "null" file
name other than the current directory.

   Also, the doc strings and the manual say nothing about using a default
   directory (yes, apparently) or whether the FILENAME argument must include a
   directory (it need not, apparently).

It would get rather tedious if every single docstring of any function
handling files had to explain the difference between relative and
absolute file names and if all these docstrings had to document the
variable default-directory.

The Elisp manual talks about relative and absolute file names and
documents default-directory.

Sincerely,

Luc.




reply via email to

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