From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Rename, delete and move current buffer and file Date: Mon, 07 May 2018 13:01:28 -0400 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1525712491 8794 195.159.176.226 (7 May 2018 17:01:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 7 May 2018 17:01:31 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 07 19:01:27 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 1fFjVt-000274-8r for ged-emacs-devel@m.gmane.org; Mon, 07 May 2018 19:01:25 +0200 Original-Received: from localhost ([::1]:47235 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFjY0-0006FB-Ae for ged-emacs-devel@m.gmane.org; Mon, 07 May 2018 13:03:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37702) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFjWD-0005Gf-8M for emacs-devel@gnu.org; Mon, 07 May 2018 13:01:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fFjW7-0005mu-CR for emacs-devel@gnu.org; Mon, 07 May 2018 13:01:45 -0400 Original-Received: from [195.159.176.226] (port=36366 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fFjW7-0005mF-5U for emacs-devel@gnu.org; Mon, 07 May 2018 13:01:39 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fFjTv-00084V-MN for emacs-devel@gnu.org; Mon, 07 May 2018 18:59:23 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 77 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:HFzk3ECXjMGF0xfNUk3QwQD7XTM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 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:225124 Archived-At: >> Similarly >> >> M-x rename-file RET >> >> could try and detect if the source name matches some of the buffers's >> filenames and ask whether we want to rename those buffers's filenames >> accordingly. [...] > People might not remember the whole command name, but when they use M-x, or > C-h f with some filtering it will pop up when typing "rename" or "move", [...] > So I stand by my commands proposal. I don't understand: it seems like "rename-file" is a name which should just work with your M-x and C-h f examples, so I don't see how those examples argues in favor of "my commands proposal" instead of using "rename-file". >> C-x C-w gives you "/current/dir/" is initial input. If you then type >> "/other/dir/" it will "move" the file without "renaming" it (I >> personally don't like to make this distinction, probably because >> I consider the file's name to include all the leading directories, which >> is also the implicit point of view of the GNU Coding Standard which uses >> "file name" rather than "path" and reserves the word "path" for things >> like $PATH, $LS_LIBRARY_PATH, load-path, ...). >> And M-n inserts the current name, so I think it handles both >> use-cases well enough. > This creates a copy of the file, while I want to rename/move it. I only presented this example to illustrate how Emacs merges both "new name" and "new directory" into a single UI (tho indeed currently C-x C-w doesn't actually "move/rename" but it copies instead). > include things like deal with version control. A single "move" function is > fine, maybe even the set-visited-file-name semantics are OK, it just has a > bad name, has no key bindings, no menu item, C-x C-w does have all those feature (other than the name). > and I would like a delete-visited-file to complement it. Could you give details as to why you'd want to separate it from `delete-file`? > When I look for a command to move a file in the M-x completion prompt, > I will try "move" and "rename" and see what matches, Right, and you'll find `rename-file`, which is what I think should do what you want. > but I would surely not naturally come up with any substring > of set-visited-file-name when thinking how Emacs might have named a command > to move files, except for "file-name", but this matches a ton of things. I > am sure many people using Emacs don't even know the concept of a visited > file. Agreed. So I find it odd that you insist on having "visited-file" in the name of the commands ;-) > Also, note there is rename-file, rename-buffer, but then > set-visited-file-name for what is effectively > rename-file-with-visited-buffer. set-visited-file-name does not rename any file, AFAIK (and I don't see any suggestion to change this). > There is also an interactive delete-file, obviously there is kill-buffer, > but no way to delete file and kill its visiting buffer. FWIW, I very rarely need to do delete-file and kill-buffer at the same time, so I'm not convinced there's a need for a separate command for that. But as noted, I'd be OK for delete-file to kill the matching buffer(s) [ either subject to a prompt or a user-config, for those users who like to `delete-file` while keeping the buffer, as is occasionally my case. ] Stefan