Fuco1 / dired-hacks

Collection of useful dired additions
GNU General Public License v3.0
873 stars 77 forks source link

Use asynchronous copy and move provided by dired-async #197

Closed aagon closed 1 year ago

aagon commented 1 year ago

The excellent dired-async library works by advising two functions, dired-create-files and wdired-do-rename. The first one is used by almost every user-facing command that copies or moves files (dired-do-copy, among others).

Except dired-ranger-paste and dired-ranger-move, that more or less reimplement part of the functionality provided by dired-create-files with the primitives copy-file or rename-file. This is why those operations were unaffected by dired-async-mode.

This PR changes the implementation of dired-ranger-copy and dired-ranger-move to a much more simple wrapper around dired-create-files, which allows get the asynchronous operations when, and only when, dired-async-mode is activated.

Since dired-create-files takes care of the reverting of the relevant buffers, the function dired-ranger--revert-target is not needed anymore.

Fix #119 Fix #160

In what is my humble opinion the simplest way possible.

Feel free to ask any questions.

Best,

Aymeric Agon-Rambosson

Fuco1 commented 1 year ago

This is really cool! Sorry for such a late response. I had no idea this existed hence my naive implementation :)