branch: externals/dired-duplicates
commit 341777674c612dcc08d8b36d77a50b87408897b2
Author: Harald Judt <[email protected]>
Commit: Harald Judt <[email protected]>
Use multiple prompts for directories instead of completing-read-multiple
This commit gets rid of the usage of completing-read-multiple, which up
until
the current release version of Emacs (29.2) does not work well with some
completing systems.
In addition to the possible buggy behaviour, using completing-read-multiple
might also not be a very obvious way for most users to specify multiple
directories, even if the possibility is mentioned in the README.
Thus, the new method is to ask the user for a directory, then for another
directory, and another one until the user enters nothing and just hits
Enter.
Signed-off-by: Harald Judt <[email protected]>
---
dired-duplicates.el | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/dired-duplicates.el b/dired-duplicates.el
index dd4ff905bd..8c069b4bbc 100644
--- a/dired-duplicates.el
+++ b/dired-duplicates.el
@@ -309,18 +309,22 @@ This is the same as `dired-do-flagged-delete', but calls
It will be local to the `dired-duplicates' buffer.")
+(defun dired-duplicates--prompt-for-directories ()
+ "Prompt the user for directories until an empty string is returned."
+ (let ((dirs nil))
+ (while (let ((dir (if (not dirs)
+ (read-file-name "Directory: " nil default-directory nil
nil #'file-directory-p)
+ (read-file-name "Another directory (or RET to start): "
nil "" nil nil #'file-directory-p))))
+ (unless (string= dir "")
+ (push dir dirs))))
+ (nreverse dirs)))
+
;;;###autoload
(defun dired-duplicates (directories)
"Find a list of duplicate files inside one or more DIRECTORIES.
The results will be shown in a Dired buffer."
- (interactive (list (completing-read-multiple "Directories: "
- #'read-file-name-internal
- #'file-directory-p
- t
- default-directory
- nil
- default-directory)))
+ (interactive (list (dired-duplicates--prompt-for-directories)))
(unless directories
(user-error "Please specify one or more directories to search in"))
(let* ((directories (if (listp directories) directories (list directories))))