emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: C-x C-v considered harmful


From: Drew Adams
Subject: RE: C-x C-v considered harmful
Date: Sun, 5 Jul 2009 07:56:10 -0700

>     But I am really curious to know why Richard changed 
>     this in rev 1.192 to the current (and (buffer-modified-p) 
>     (buffer-file-name)) behavior. Richard, do you remember?
> 
> I don't remember, but I would guess it is becuase most 
> non-file-visiting buffers don't contain precious information.
> I probably did not think about the cases where they do.

To be clear about my own position: I said I think the right test for
`kill-buffer'  to use is `(or buffer-read-only (buffer-modified-p))', but that
is only if people decide that loss of data in non-file buffers is indeed a
problem that needs solving.

Personally, I don't have a problem with the current situation, but if we do
decide to make a change to prevent data loss in such buffers, then I think that
is the best such change.

Another, alternative possibility would be to test whether (besides a modified
file buffer) the buffer belongs to some specified set. The set of buffers to
warn about could be defined using a list of buffer names or regexps that match
buffer names.

I mention this because I think it does make sense that most modified non-file
buffers _not_ warn you when they are killed - perhaps even most that are not
read-only. If `kill-buffer' were to warn each time you kill such a buffer it
might prove annoying.

However, the `buffer-read-only' test would go a long way toward eliminating such
annoyance. Many non-file buffers that would be `buffer-modified-p' are in fact
read-only. That includes buffers such as `*grep*', `*Buffer List*', and Dired.
The "data" in such buffers is not normally something that we worry about losing
accidentally.

I guess the question is whether most other non-file buffers are more like
`*shell*', where a warning might be appropriate, or are more like `*grep*',
where a warning is probably inappropriate. If `*shell*' is rather the exception,
then perhaps it would be best to treat it as an exception, using, say, an option
`kill-buffer-warn-regexps', with a value of, say, `(,(regexp-quote "*shell*"))'.
IOW, do something similar to `same-window-regexps' and
`same-window-buffer-names'.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]