In this previous
Emacs - Async File Copying in Dired using Rsync,
I have demonstrated how to use rsync to replace the built-in Dired copy
function. Today, I have improved that function so that rsync window will dislay
progress separately from my currently working windows. Moreover, after finishing
copying, it will show the message and automatically close the progress window
after 5 seconds. Also, the rsync progress window can not be selected by call
other-window. As a result, the rsync feature now does not affect my current
work. I can continue what I’m currently doing while leaving rsync take care of my
files.
Note: it would not run on Windows computers.
Implementation
This is the new code. Put it in your .emacs, replace with my old rsync function
if you have already use it.
Update 8 Apr 2013: I have improved the code a little bit so that later it
will be much easier for me to add new async function like moving,
compressing,… Also, this time, you can run multiple rsync process.
tmtxt/dired-async function: run the input command asynchronously
tmtxt/dired-async-new-async-window function: create a new window for async
command to display output
tmtxt/dired-async-process-handler function: handle when process finish
execution, kill the buffer and the window that hold the process
tmtxt/dired-async-rsync function: interactive function to execute rsync
Finally, bind it to a key combination, in my case it it C-c C-r
To use it, open up a dired window, select some file that you want to copy and
press the key combination C-c C-r, select the destination and press RET.
If you have the variable dired-dwim-target set to t, you can open 2
dired windows and this command will automatically choose the directory in the
other window as the default destination folder. The rsync progress window will
display in the bottom without affecting your current workspace. After finishing
copying, it will display a message and automatically close the rsync window
after 5 second.
In summary, we can use it in the same way that we used to use other dired copy
and move functions.
Coming up next
I’m currently developing some functions that help emacs dired execute tasks
asynchonously (since dired is my default my management application). I’m
currently in those final weeks of the semester so I don’t have much time. If you
want those features, wait for me to finish my semester in May.