[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: |
Tue, 3 Jan 2006 14:23:36 -0600 (CST) |
Drew Adams wrote:
As to why I "care so much" and the "extreme rarity" of an empty file name,
I've already given this simple example (twice):
(while (or (string= "" name) (not (file-readable-p name)))
(setq name (read-file-name prompt...)))
The example shows:
In my previous reply, I forgot that read-file-name returns "" if the
user exits with empty input (and _not_ the DEFAULT-FILENAME arg). So
your real question is why read-file-name does that, a rather different
question from the one you asked.
Here is what the Elisp doc of find-file-name says:
If the user types <RET> in an empty minibuffer, this function
returns an empty string, regardless of the value of EXISTING.
This is, for instance, how the user can make the current buffer
visit no file using `M-x set-visited-file-name'.
This is what the docstring of set-visited-file-name says:
FILENAME nil or an empty string means mark buffer as not visiting any
file. Remember to delete the initial contents of the minibuffer if
you wish to pass an empty string as the argument.
So you could make your function do something similar if you want to.
read-file-name returns "" on empty input to allow its caller to attach
a special meaning to exiting with an empty minibuffer.
Sincerely,
Luc.
- RE: Null filename ("") is considered to correspond to an existing, readable, and writable file?, (continued)
- 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
- 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?, 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
- 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?, Drew Adams, 2006/01/03