From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?B?SmFyb3PFgmF3IFJ6ZXN6w7N0a28=?= Newsgroups: gmane.emacs.devel Subject: Re: Rename, delete and move current buffer and file Date: Tue, 8 May 2018 09:05:55 +0200 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000f685a5056bac6aa8" X-Trace: blaine.gmane.org 1525763074 17256 195.159.176.226 (8 May 2018 07:04:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 8 May 2018 07:04:34 +0000 (UTC) To: "emacs-devel@gnu.org" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 08 09:04:30 2018 Return-path: Envelope-to: ged-emacs-devel@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 1fFwfk-0004NN-ST for ged-emacs-devel@m.gmane.org; Tue, 08 May 2018 09:04:29 +0200 Original-Received: from localhost ([::1]:49639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFwhr-0006fW-RC for ged-emacs-devel@m.gmane.org; Tue, 08 May 2018 03:06:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57118) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFwhD-0006fP-1o for emacs-devel@gnu.org; Tue, 08 May 2018 03:06:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fFwhB-0005pz-O2 for emacs-devel@gnu.org; Tue, 08 May 2018 03:05:59 -0400 Original-Received: from mail-yb0-x236.google.com ([2607:f8b0:4002:c09::236]:35005) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fFwhB-0005pl-HD for emacs-devel@gnu.org; Tue, 08 May 2018 03:05:57 -0400 Original-Received: by mail-yb0-x236.google.com with SMTP id j143-v6so1698989ybg.2 for ; Tue, 08 May 2018 00:05:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=QXPJ8h9aWWqo3VeVmfuvG/WoICx2RWZmsmeAf3pWcaU=; b=b/h0XLDO+qR15u5UmZ5wZ0gKICBf+BrQnUNZ2mDfETbnSXFW3OgftWtC/c9CUIDjmK yfYeV1dMJCdRUCqNXH0N1v1Y6lkCDqrkUSiTV+8fHRxAvi/YMNQJ550RcWudfRBC3vbh 3Lr+RAin2bmSRYTdi7rc/YIyM2PfoueJjGfiH5+PFPzGLltGDPHMLVX6bv2t2U/a8vDd 2uDT9uW+iyCSPYvHoXsRhzBik6iEOh4qQQkoyU7Omu3Dr7PQNiRlNV7mByteZfzLdpmF wht1i7TtnmUrYZrczxbWZVsL31vTOIDCh47+XP12EL0qxde/w5AEn+SNrJbqtVKEvxpg rGnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=QXPJ8h9aWWqo3VeVmfuvG/WoICx2RWZmsmeAf3pWcaU=; b=iblwBYtp5r87DWANfijpupP3k6WekIV2uwqH/6i+KgSn3ArfwXaEeTnOYQIeTsa4Vt z/wLLxhvpEOZqcFqg6L773/n9XjcOGWzaR9gX49sC7q+QRjlGwdbGD1PiTo3UhEJXIfu y1gZiUW4DIDC7L57KyBTNfpA9YudBfRaCy8belYxD7U3GNvkXo2cgtgCz/4LKzsWwiSK jFX0ArfQ5d1sXXzOpOZ6/qY1KbwecsuOqCIIPNM8jNxdry2FFxREBr3ul2yWI+zyGlZq as6y2FbOUg5wVCgnA/EzhApA12Yyb2n8VbuozOnXQnBINH+BPbPydRtDZYGydIiSGktP wHPQ== X-Gm-Message-State: ALKqPwfWlyWsejDtYKvXtZixyR7Khc2wXtOQzxATjuYTnWScKfI9GaDn NNJuWlAq0Faq7rp6oFWNpa+OuRwydhDwt9CeQEihqg== X-Google-Smtp-Source: AB8JxZresX6gQOfwgfBVAhxZaFGiGzhnRHyZlbe7z9ECurA3xAjApx9ixLft6UOITGOEU7RCG1xR0wlu1fVdrReD84Q= X-Received: by 2002:a25:1304:: with SMTP id 4-v6mr4174217ybt.484.1525763156639; Tue, 08 May 2018 00:05:56 -0700 (PDT) Original-Received: by 2002:a5b:b08:0:0:0:0:0 with HTTP; Tue, 8 May 2018 00:05:55 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4002:c09::236 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:225147 Archived-At: --000000000000f685a5056bac6aa8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, May 8, 2018 at 3:28 AM, Stefan Monnier wrote: > > I have a file open in a buffer in front of me. I want to rename this fi= le > > and have the buffer be changed accordingly: it should now be visiting t= he > > file under the new name. > > > > rename-file will instead: > > - rename the file but do nothing with the buffer, if I now save the > buffer > > it will get saved under the old file name. The buffer still visits the > file > > under the old name. > > That's how it works currently. But we're talking about making changes. > > > - it will also first prompt for a file to rename, while I want to renam= e > > the file I am currently editing in a buffer, along with the buffer. > > Right. That's why I suggested to use C-x C-w for this particular case. > (but rename-file (c|sh)ould still be changed accordingly). > I do not understand what you have in mind with write-file. This creates a copy, which is natural given the name. Do you envision some changes to it? Or do you mean I should just use write-file and delete the old file? Some years ago there was a conversation on emacs-devel on this topic and you yourself proposed something like rename-current-file: https://lists.gnu.org/archive/html/emacs-devel/2009-08/msg01132.html Someone even sent a patch, RMS objected to the name, and then the conversation stalled and I think nothing was changed. Some of the names I have thrown around like rename-visited-file-with-buffer attempt to deal with the ambiguity & asymmetry with respect to existing functions RMS might possibly had in mind back then. I think in this case the function names will either be short, intuitive and slightly ambiguous or the names will be long, unintuitive and precise - due to the distinction between buffer, visisted file, the fact that you have a current buffer but not really a current file, the fact that many buffers might visit the same file etc., it is very easy to come up with a lot of different names and equally easy to find something slightly wrong with each of them. Maybe it is better to have a shorter name that is not 100% precise but is intuitive to the users than have a very precise name that nobody remembers and few people will be able to discover. To try to move this forward constructively: I like the idea of delete-file/rename-file prompting whether to also kill/rename the associated buffers. However, by itself it does not yet fulfill the use case I had in mind, of dealing the file visited by the current buffer. I would be fine with something like delete-current-file/rename-current-file that just calls delete-file/rename-file on the current buffers file, and then having delete-file/rename-file prompt for modifying some or all of the (potentially several) visiting buffers. That's I think a pretty conservative change that helps accomplish a basic task many people want to do, quickly, easily and without distractions. Cheers, Jaros=C5=82aw Rzesz=C3=B3tko --000000000000f685a5056bac6aa8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Tue, May 8, 2018 at 3:28 AM, Stefan Monnier <monnier@iro.umo= ntreal.ca> wrote:
> I have a file open in a buffer in fr= ont of me. I want to rename this file
> and have the buffer be changed accordingly: it should now be visiting = the
> file under the new name.
>
> rename-file will instead:
> - rename the file but do nothing with the buffer, if I now save the bu= ffer
> it will get saved under the old file name. The buffer still visits the= file
> under the old name.

That's how it works currently.=C2=A0 But we're talking about= making changes.

> - it will also first prompt for a file to rename, while I want to rena= me
> the file I am currently editing in a buffer, along with the buffer.
Right.=C2=A0 That's why I suggested to use C-x C-w for this part= icular case.
(but rename-file (c|sh)ould still be changed accordingly).
=

I do not understand what you have in mind with write-fi= le. This creates a copy, which is natural given the name. Do you envision s= ome changes to it? Or do you mean I should just use write-file and delete t= he old file? Some years ago there was a conversation on emacs-devel on this= topic and you yourself proposed something like rename-current-file:


Someone even sent a= patch, RMS objected to the name, and then the conversation stalled and I t= hink nothing was changed. Some of the names I have thrown around like renam= e-visited-file-with-buffer attempt to deal with the ambiguity & asymmet= ry with respect to existing functions RMS might possibly had in mind back t= hen. I think in this case the function names will either be short, intuitiv= e and slightly ambiguous or the names will be long, unintuitive and precise= - due to the distinction between buffer, visisted file, the fact that you = have a current buffer but not really a current file, the fact that many buf= fers might visit the same file etc., it is very easy to come up with a lot = of different names and equally easy to find something slightly wrong with e= ach of them. Maybe it is better to have a shorter name that is not 100% pre= cise but is intuitive to the users than have a very precise name that nobod= y remembers and few people will be able to discover.

To try to move this forward constructively: I like the idea of delete-fil= e/rename-file prompting whether to also kill/rename the associated buffers.= However, by itself it does not yet fulfill the use case I had in mind, of = dealing the file visited by the current buffer. I would be fine with someth= ing like delete-current-file/rename-current-file that just calls delete-fil= e/rename-file on the current buffers file, and then having delete-file/rena= me-file prompt for modifying some or all of the (potentially several) visit= ing buffers. That's I think a pretty conservative change that helps acc= omplish a basic task many people want to do, quickly, easily and without di= stractions.=C2=A0

Cheers,
Jaros=C5=82aw Rzesz=C3=B3tko
--000000000000f685a5056bac6aa8--