From: "Drew Adams" <drew.adams@oracle.com>
To: "Emacs-Devel" <emacs-devel@gnu.org>
Subject: find-file for file that was deleted, when visiting buffer still exists
Date: Sat, 3 Mar 2007 09:29:49 -0800 [thread overview]
Message-ID: <BDEIJAFNGDOAGCJIPKPBMEBDCDAA.drew.adams@oracle.com> (raw)
This has been standard Emacs behavior for a long time, but I wonder about
it.
1. Visit a file `foo' in a buffer. Close the window, but don't kill the
buffer.
2. Delete file `foo' (e.g. `delete-file' or some other way that doesn't also
kill the buffer).
3. `C-x C-f foo'
This raises an error saying that the file no longer exists.
[The error message says nothing about the existing buffer, BTW. If a user
forgets that the buffer still exists, then s?he might have a difficult time
understanding this message and why s?he can't use `C-x C-f' to create a new
file named `foo'.]
I wonder if this is really what Emacs should always do in this context.
IIUC, the real problem is that the buffer still exists, and Emacs can't know
what the user wants to do in this case. S?he might want to save the buffer.
S?he might want to kill the buffer and create a new file-visiting buffer
with the same name. There are perhaps additional possibilities.
This error is raised by `find-file-noselect', which is not a command, so not
much is known about the user context at this point - the function might even
be run in batch. IOW, the error is raised at a fairly low level, in a
function that is called in many different ways.
I wonder if it wouldn't be good to try to deal with the interactive cases by
asking the user what to do. That is, try to handle the error by passing it
up to the command (`find-file' etc.) whenever the command is called
interactively.
Perhaps a dialog something like this:
Buffer `foo' was visiting file `foo', which no longer exists.
Choose one:
s RET - Save buffer `foo' as file `foo'
k RET - Visit a new, empty file in buffer `foo'
RET - Do nothing
WDOT? Am I missing something important that argues for the current behavior
even for interactive use? If my suggestion is a bad idea, can we at least
improve the error message, so that it mentions the existing buffer?
next reply other threads:[~2007-03-03 17:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-03 17:29 Drew Adams [this message]
2007-03-03 18:02 ` find-file for file that was deleted, when visiting buffer still exists Mathias Dahl
2007-03-05 2:55 ` Richard Stallman
2007-03-05 4:57 ` Drew Adams
2007-03-05 21:50 ` Richard Stallman
2007-03-05 7:14 ` Mathias Dahl
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BDEIJAFNGDOAGCJIPKPBMEBDCDAA.drew.adams@oracle.com \
--to=drew.adams@oracle.com \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.