From: "Drew Adams" <drew.adams@oracle.com>
To: "'Bob Rogers'" <rogers-emacs@rgrjr.dyndns.org>
Cc: emacs-devel@gnu.org
Subject: RE: C-x C-v considered harmful
Date: Sun, 5 Jul 2009 00:13:36 -0700 [thread overview]
Message-ID: <AEA1A00FFB574128B23E5DDE3DB14F54@us.oracle.com> (raw)
In-Reply-To: <19023.58051.10608.629206@rgr.rgrjr.com>
> Does `C-x k' warn you the way you would like, when you use
> it in a *shell* buffer? If not, then that is the problem,
> not something else.
>
> It does indeed kill the *shell* buffer without prompting,
Then the command-behavior problem has nothing to do with `find-alternate-file',
per se - any buffer-killing command will present the same problem. There remains
the other problem: that of key confusion raising the risk of accidentally using
some buffer-killing command.
> which seems odd, given that it prompts for modified files.
> I notice that this code uses the C equivalent of "(and
> (buffer-modified-p) (buffer-file-name))",
Donc, meme combat.
> though it queries only if interactive,
Yes, as I stated earlier, testing `interactive-p' should probably be part of the
mix. Non-interactive use of a command that kills a buffer should not necessarily
(or usually) query. It is the interactive use that we want to protect against.
> so a case could be made for dropping the the "(buffer-file-name)"
> for symmetry.
(Not just for symmetry.)
At least you and I agree about dropping `buffer-file-name' - dunno about others.
I maintain, however, that the proper test is `(or buffer-read-only
(buffer-modified-p))'. As I mentioned, there are some "modified" buffers that
one doesn't necessarily need to be warned about losing - things like *Buffer
List* and Dired.
The problem here is the concept of buffer "modification". If the aim is to
prevent data loss, then that aim is typically not advanced by not allowing a
modified read-only buffer to be dropped without query.
> But I have never had the problem of invoking "C-x k" by accident
> (that I recall), so I'm not sure such a case ought to be made.
Well, sure, you got stung because you use the version-control prefix, `C-x v', a
lot. If you used the kmacro prefix, `C-x C-k', a lot, then `C-x k' would sting
you. Any way of accidentally invoking any buffer-killing command presents the
same problem.
> And as you mentioned, `find-alternate-file' tests `(and
> (buffer-modified-p) (buffer-file-name))'. I agree with you that the
> problem you are seeing is coming from `(buffer-file-name)'
> being nil, and that removing that might be an improvement.
>
> As far as I am concerned, removing "(buffer-file-name)" would be
> sufficient.
We agree, modulo my wanting to be able to drop modified read-only buffers
without warning. Another way to look at that is that those buffers typically do
not have undo, which is another indication that we don't expect their contents
to be something we want to worry about saving. The proper test is, I think, `(or
buffer-read-only (buffer-modified-p))'.
next prev parent reply other threads:[~2009-07-05 7:13 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-02 1:18 C-x C-v considered harmful Bob Rogers
2009-07-02 2:39 ` Miles Bader
2009-07-02 3:10 ` Bob Rogers
2009-07-02 6:48 ` Kevin Rodgers
2009-07-02 15:17 ` Drew Adams
2009-07-03 1:09 ` Bob Rogers
2009-07-03 3:19 ` Drew Adams
2009-07-03 20:33 ` Bob Rogers
2009-07-03 22:23 ` Drew Adams
2009-07-04 23:16 ` Bob Rogers
2009-07-05 7:13 ` Drew Adams [this message]
2009-07-06 0:39 ` Bob Rogers
2009-07-06 1:40 ` Drew Adams
2009-07-07 10:39 ` Johan Bockgård
2009-07-05 10:18 ` Richard Stallman
2009-07-05 14:56 ` Drew Adams
2009-07-05 0:05 ` Richard Stallman
2009-07-05 7:10 ` Drew Adams
2009-07-06 15:05 ` Richard Stallman
2009-07-06 15:59 ` Drew Adams
2009-07-07 10:05 ` Richard Stallman
2009-07-06 12:04 ` Robert J. Chassell
2009-07-06 23:49 ` Juri Linkov
2009-07-07 1:07 ` Drew Adams
2009-07-08 0:32 ` Juri Linkov
2009-07-08 23:28 ` Juri Linkov
2009-07-09 16:09 ` Drew Adams
2009-07-09 22:10 ` Juri Linkov
2009-07-09 22:26 ` Drew Adams
2009-07-09 22:46 ` Juri Linkov
2009-07-09 23:21 ` Drew Adams
2009-07-10 4:05 ` Bob Rogers
2009-07-13 20:05 ` Juri Linkov
2009-07-16 21:57 ` Juri Linkov
2009-07-03 2:40 ` M Jared Finder
2009-07-03 2:57 ` Miles Bader
2009-07-03 19:23 ` Richard Stallman
2009-07-03 20:07 ` Andreas Schwab
2009-07-03 20:56 ` Miles Bader
2009-07-03 13:55 ` Markus Triska
2009-07-05 22:15 ` Stefan Monnier
2009-07-05 22:42 ` Bob Rogers
2009-07-11 10:06 ` Stefan Monnier
2009-07-14 2:45 ` Bob Rogers
2009-07-14 18:34 ` Stefan Monnier
2009-07-02 21:03 ` Stefan Monnier
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=AEA1A00FFB574128B23E5DDE3DB14F54@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=emacs-devel@gnu.org \
--cc=rogers-emacs@rgrjr.dyndns.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.