emacs-devel
[Top][All Lists]
Advanced

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

Re: undo-kill-buffer


From: Aaron Maxwell
Subject: Re: undo-kill-buffer
Date: Tue, 24 Oct 2006 09:46:58 -0700
User-agent: KMail/1.9.4

Hi Davis,

There are two levels to what I'm envisioning.

First is the simple case when the killed buffer corresponds to a file with no 
unsaved changes.  In that case, undo-kill-buffer would have the same effect 
as doing a find-file on that file again.  Mainly the advantage is 
convenience; M-x undo-kill-buffer will be approximately as fast as navigating 
the filesystem to locate the file.  Much more importantly, I do not have to 
think; I can re-get that file (buffer) without interrupting concentration.  
This becomes more important when working with many files in several 
directories at once.

Second is when killing a buffer that has not been associated with a file, or a 
buffer that has unsaved changes.  This would have to be handled differently 
from the above.  The buffer contents would have to be cached somehow.  I'd 
probably have this be (de)activateable via a variable setting; if 
deactivated, undo-kill-buffer would get the last saved version, xor fail.

Thanks,
Aaron

On Tuesday 24 October 2006 09:11, Stuart D. Herring wrote:
> > Hi, Does anyone know of an existing emacs function that will undo a
> > kill-buffer command?  So like, if the user issues C-x k and then suddenly
> > decides it was a mistake, they could just M-x undo-kill-buffer to get it
> > back.
> >
> > I have started coding this for myself.  If it's genuinely new and I'm not
> > duplicating effort, then I will polish it and contribute to the main
> > codebase.
> >
> > Thanks,
> > Aaron
>
> The only case where killing a buffer cannot be undone with such commands
> as `find-file' or `dired' is when the buffer contained unsaved changes or
> was not associated with an external repository (file, directory, IRC
> channel, etc.), like `*scratch*'.  How do you propose to bring such
> buffers (and their changes, if any) back without causing `kill-buffer' to
> not, in fact, kill buffers?
>
> If you are doing that (interfering with `kill-buffer'), what you really
> want is probably a "Trash Can" for buffers.  Then you want to have a
> "mark-buffer-for-kill" command (which toggles the buffer's state, and
> buries it if it's being marked), and then a "kill-marked-buffers" command
> to actually destroy them.  Of course, this is already available via the
> buffer list (`list-buffers')...
>
> Davis




reply via email to

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