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: Tue, 3 Jan 2006 14:23:36 -0600 (CST) [thread overview]
Message-ID: <200601032023.k03KNag06354@raven.dms.auburn.edu> (raw)
In-Reply-To: <DNEMKBNJBGPAOPIJOOICMEAPDBAA.drew.adams@oracle.com>
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.
next prev parent reply other threads:[~2006-01-03 20:23 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
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 [this message]
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=200601032023.k03KNag06354@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).