[Top][All Lists]

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

[elpa] externals/async d6222c2 22/60: Ensure wdired-use-interactive-rena

From: Stefan Monnier
Subject: [elpa] externals/async d6222c2 22/60: Ensure wdired-use-interactive-rename is disabled.
Date: Tue, 8 Oct 2019 10:11:30 -0400 (EDT)

branch: externals/async
commit d6222c2959caaca5c4980038756097da8a51e505
Author: Thierry Volpiatto <address@hidden>
Commit: Thierry Volpiatto <address@hidden>

    Ensure wdired-use-interactive-rename is disabled.
    * dired-async.el (dired-async-wdired-do-renames): New advice.
    (wdired-do-renames): Same.
    (dired-async-mode): Add new advice.
 dired-async.el | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/dired-async.el b/dired-async.el
index ed37953..a68098a 100644
--- a/dired-async.el
+++ b/dired-async.el
@@ -310,6 +310,19 @@ ESC or `q' to not overwrite any of the remaining files,
       (dired-async--modeline-mode 1)
       (message "%s proceeding asynchronously..." operation))))
+(defvar wdired-use-interactive-rename)
+(defun dired-async-wdired-do-renames (old-fn &rest args)
+  ;; Perhaps a better fix would be to ask for renaming BEFORE starting
+  ;; OLD-FN when `wdired-use-interactive-rename' is non-nil.  For now
+  ;; just bind it to nil to ensure no questions will be asked between
+  ;; each rename.
+  (let (wdired-use-interactive-rename)
+    (apply old-fn args)))
+(defadvice wdired-do-renames (around wdired-async)
+  (let (wdired-use-interactive-rename)
+    ad-do-it))
 (defadvice dired-create-files (around dired-async)
   (dired-async-create-files file-creator operation fn-list
                             name-constructor marker-char))
@@ -321,11 +334,15 @@ ESC or `q' to not overwrite any of the remaining files,
   :global t
   (if dired-async-mode
       (if (fboundp 'advice-add)
-          (advice-add 'dired-create-files :override #'dired-async-create-files)
-          (ad-activate 'dired-create-files))
+          (progn (advice-add 'dired-create-files :override 
+                 (advice-add 'wdired-do-renames :around 
+        (ad-activate 'dired-create-files)
+        (ad-activate 'wdired-do-renames))
       (if (fboundp 'advice-remove)
-          (advice-remove 'dired-create-files #'dired-async-create-files)
-          (ad-deactivate 'dired-create-files))))
+          (progn (advice-remove 'dired-create-files #'dired-async-create-files)
+                 (advice-remove 'wdired-do-renames 
+          (ad-deactivate 'dired-create-files)
+          (ad-deactivate 'wdired-do-renames))))
 (provide 'dired-async)

reply via email to

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