[Top][All Lists]

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

RE: How to visit a file and kill the current buffer?

From: Drew Adams
Subject: RE: How to visit a file and kill the current buffer?
Date: Sun, 10 Sep 2017 18:16:04 +0000 (UTC)

> Is there a way to visit a file in the current window and at the same
> time kill the previous buffer that occupied the current window? I am
> looking for something that behaves like the “Open” functionality in
> simple GUI text editors (like leafpad).
> Very often I have a frame displaying a file, but I no longer need to
> have that file open. I wish to instead open another file. What I do
> currently is to do C-x C-f and visit the new file, then kill the now
> unneeded buffer, but it is annoying to have to do this in 2 steps.
> Moreover, I tend to forget the later step and then I accumulate a lot of
> “garbage” buffers that are visiting files that I am no longer interested in.

Yes.  `C-x C-v' (`find-alternate-file') does what you want.

It prompts for the name of a file to visit, visits that
file in the selected window, and kills the buffer that
was displayed there.

reply via email to

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