If I use C-xC-w (write-file)
to write the current buffer's content to a new location, then afterwards my buffer will be visiting the new file instead of the original one. Sometimes I would like to save off a copy of the buffer to a new location, but then keep editing at the original location.
I know I can kill the existing filename from the (write-file)
minibuffer history, and then yank that back at the C-xC-f (find-file)
prompt immediately afterwards to re-visit the original file, and this is the work-around I use at the moment. However, this feels inelegant.
I had wondered if (write-file)
might take a prefix argument of some kind to not visit the buffer, but this only appears to affect overwrite confirmation.
So: Is there any simpler way to save my buffer content to a file without altering which file I'm visiting?
Select the entire buffer with C-xh, then use M-xwrite-region
.