From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: Rename, delete and move current buffer and file
Date: Mon, 07 May 2018 21:28:12 -0400 [thread overview]
Message-ID: <jwv4ljjx7mf.fsf-monnier+gmane.emacs.devel@gnu.org> (raw)
In-Reply-To: CAO_X8WCPsYLDCpF+=W+W2wL9Zp+F3rG-YorKp5q3NNW8kaGy8A@mail.gmail.com
> I have a file open in a buffer in front 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 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 rename
> 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).
>> > 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).
> If you set the along-with-file argument to t, or use prefix argument, I
> think it executes a rename like the one I would like to be able to do, so
> file+buffer.
Nope, it ignores prefix args and the `along-with-file` argument only
tells it that *something else* has moved the file.
> delete-file and rename-file prompting whether to do the corresponding
> action also on the buffer makes sense in general, better yet if it would be
> possible to configure Emacs to do this always, by default, when using the
> functions interactively. Is something like that safe with regards to
> backward compatibility?
If it's only done when used interactively, it should be safe, yes.
> Those act on a file you have to select though, I would like something that
> specifically acts on the current buffer and its visited file.
Hence C-x C-w (aka `write-file`).
Stefan
next prev parent reply other threads:[~2018-05-08 1:28 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-07 13:58 Rename, delete and move current buffer and file Jarosław Rzeszótko
2018-05-07 14:53 ` Stefan Monnier
2018-05-07 16:20 ` Jarosław Rzeszótko
2018-05-07 17:01 ` Stefan Monnier
2018-05-07 17:47 ` Jarosław Rzeszótko
2018-05-08 1:28 ` Stefan Monnier [this message]
2018-05-08 7:05 ` Jarosław Rzeszótko
2018-05-09 12:28 ` Stefan Monnier
2018-05-09 18:12 ` Radon Rosborough
2018-05-09 22:44 ` Stefan Monnier
2018-05-10 17:01 ` Radon Rosborough
2018-05-10 21:49 ` Stefan Monnier
2018-05-11 7:31 ` Andreas Schwab
2018-05-11 15:33 ` Stefan Monnier
2018-05-11 15:45 ` Paul Eggert
2018-05-11 16:06 ` Clément Pit-Claudel
2018-05-11 16:14 ` Stefan Monnier
2018-05-09 23:50 ` Van L
2018-05-10 5:37 ` Jarosław Rzeszótko
2018-05-10 13:18 ` Van L
2018-05-10 8:20 ` Amit Ramon
2018-05-10 8:59 ` Phil Sainty
2018-05-10 16:04 ` Eli Zaretskii
2018-05-07 18:20 ` Andreas Schwab
2018-05-08 1:28 ` Stefan Monnier
2018-05-07 15:28 ` Yuri Khan
2018-05-07 16:20 ` Jarosław Rzeszótko
2018-05-09 11:46 ` Tino Calancha
2018-05-07 15:29 ` Andreas Röhler
2018-05-07 15:38 ` Andreas Röhler
2018-05-10 0:46 ` net june
2018-05-11 6:26 ` Andreas Röhler
2018-05-11 16:10 ` net june
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv4ljjx7mf.fsf-monnier+gmane.emacs.devel@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).