From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: How to visit a file and kill the current buffer? Date: Sun, 10 Sep 2017 18:16:04 +0000 (UTC) Message-ID: <9b3b9c53-f477-47ef-935a-4e7c80993410@default> References: <82eece41-ee93-636c-1917-39462ce86106@yandex.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1505067417 5682 195.159.176.226 (10 Sep 2017 18:16:57 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 10 Sep 2017 18:16:57 +0000 (UTC) To: =?utf-8?B?TWFyaW8gQ2FzdGVsw6FuIENhc3Rybw==?= , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Sep 10 20:16:50 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dr6mW-0000N4-UR for geh-help-gnu-emacs@m.gmane.org; Sun, 10 Sep 2017 20:16:33 +0200 Original-Received: from localhost ([::1]:53835 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dr6me-00025r-9H for geh-help-gnu-emacs@m.gmane.org; Sun, 10 Sep 2017 14:16:40 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dr6mD-00025j-2q for help-gnu-emacs@gnu.org; Sun, 10 Sep 2017 14:16:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dr6m9-0000o8-VL for help-gnu-emacs@gnu.org; Sun, 10 Sep 2017 14:16:13 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:17930) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dr6m9-0000nx-Mh for help-gnu-emacs@gnu.org; Sun, 10 Sep 2017 14:16:09 -0400 Original-Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v8AIG7vd030511 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 10 Sep 2017 18:16:07 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v8AIG6rn028366 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 10 Sep 2017 18:16:07 GMT Original-Received: from ubhmp0018.oracle.com (ubhmp0018.oracle.com [156.151.24.71]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v8AIG5ef032613; Sun, 10 Sep 2017 18:16:06 GMT In-Reply-To: <82eece41-ee93-636c-1917-39462ce86106@yandex.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6774.5000 (x86)] X-Source-IP: userv0021.oracle.com [156.151.31.71] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 156.151.31.81 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:114230 Archived-At: > 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 =E2=80=9COpen=E2=80=9D functi= onality in > simple GUI text editors (like leafpad). >=20 > 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 > =E2=80=9Cgarbage=E2=80=9D buffers that are visiting files that I am no lo= nger 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.