Skip to content

Commit

Permalink
dired-find-duplicates fix buffer killing.
Browse files Browse the repository at this point in the history
  • Loading branch information
kensanata committed Feb 15, 2014
1 parent 8ecc6da commit 6c5b4a4
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions dired-duplicates.el
Expand Up @@ -62,7 +62,8 @@ filenames, obviously."
(y-or-n-p "Save time and use timestamp instead of MD5 hash? ")
(y-or-n-p "Ignore directory structures? ")))
(let ((candidates (directory-files dir))
different-files)
different-files file-alist)
(message "Building list of files...")
;; recurse subdirectories for both lists
(dolist (file files)
(when (and (file-directory-p file)
Expand All @@ -74,15 +75,16 @@ filenames, obviously."
(not (string= (file-name-nondirectory file) "."))
(not (string= (file-name-nondirectory file) "..")))
(setq candidates (nconc candidates (directory-files dir)))))
(when nodir
(setq file-alist (mapcar (lambda (f)
(cons (file-name-nondirectory f)
(expand-file-name f dir)))
candidates)))
;; go through the files
(dolist (file files)
(message "Looking at %s..." file)
(let* ((other (if nodir
(cdr (assoc (file-name-nondirectory file)
(mapcar (lambda (f)
(cons (file-name-nondirectory f)
(expand-file-name f dir)))
candidates)))
(cdr (assoc (file-name-nondirectory file) file-alist))
(expand-file-name file dir)))
(file-attributes (file-attributes file))
(other-attributes (and other (file-attributes other))))
Expand Down Expand Up @@ -113,10 +115,12 @@ filenames, obviously."
(push file different-files)))))
(let ((buf (get-buffer "*duplicated files*")))
(when buf
(with-current-buffer buf
(erase-buffer))))
(dired (cons (get-buffer-create "*duplicated files*")
(reverse different-files)))))
(kill-buffer buf)))
(message "%S" different-files)
(if (not different-files)
(message "All files are duplicates")
(dired (cons "*duplicated files*"
(reverse different-files))))))

(provide 'dired-duplicates)

Expand Down

0 comments on commit 6c5b4a4

Please sign in to comment.