> I just wrote this function to make a backup of the current file, but
> I'm not happy with the solution I used: I have this second write-file
> to return to the original file.
> Is there a better (probably also faster) way?
it's better to use write-region: that doesn't change the buffer's
association with the file.