bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56229: title: add a function to move a file from one place to anothe


From: Zachary Kanfer
Subject: bug#56229: title: add a function to move a file from one place to another
Date: Sun, 26 Jun 2022 00:49:33 -0400

There's currently no good way to move a file from one place to another.

Emacs has #'write-file, which writes a buffer to a new location. But if the buffer was previously associated with a file, it leaves that old file there.

There is #'rename-file, but there are some problems with it.
1. It is file-based. That is, it prompts twice: once for a file to move, and a second time for the file location to move to. It would be easier if we had a function that moved the current buffer.
2. It does not modify any buffers. After running #'rename-file, any buffers with the old file are left open associated with the *old* file. Saving one of these buffers results in the old location being written again.

So, attached is a patch for an interactive function that prompts for a new location, then writes the current buffer to that location. Assuming it's successful, and the buffer previously was associated with a file, it deletes the old file.

The result is to move the file from one location to another. Because it delegates to #'write-file, we get a lot of behavior for free, like ending up in a buffer associated with the new file.

Attachment: 0001-Add-a-function-to-move-a-file.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]