[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
find-file-existing
From: |
martin rudalics |
Subject: |
find-file-existing |
Date: |
Thu, 28 Sep 2006 18:10:10 +0200 |
User-agent: |
Mozilla Thunderbird 1.0 (Windows/20041206) |
`find-file-existing' is currently defined as:
(defun find-file-existing (filename &optional wildcards)
"Edit the existing file FILENAME.
Like \\[find-file] but only allow a file that exists."
(interactive (find-file-read-args "Find existing file: " t))
(unless (file-exists-p filename) (error "%s does not exist" filename))
(find-file filename wildcards)
(current-buffer))
The wildcards argument is misleading. I'd rewrite this as:
(defun find-file-existing (filename)
"Edit the existing file FILENAME.
Like \\[find-file] but do not process wildcards and only allow a file
that exists."
(interactive (nbutlast (find-file-read-args "Find existing file: " t)))
(if (and (not (interactive-p)) (not (file-exists-p filename)))
(error "%s does not exist" filename)
(find-file filename)
(current-buffer)))
Obviously, one could do wildcards matching as well, but maybe it's not
worth the trouble.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- find-file-existing,
martin rudalics <=