emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/dired-duplicates 31c1aa8880 40/57: Rename all occurrenc


From: ELPA Syncer
Subject: [elpa] externals/dired-duplicates 31c1aa8880 40/57: Rename all occurrences of find-duplicates to dired-duplicates
Date: Sat, 4 Nov 2023 06:58:30 -0400 (EDT)

branch: externals/dired-duplicates
commit 31c1aa88808dd3e14dbdf2fce332c5fc1ed634fb
Author: Harald Judt <h.judt@gmx.at>
Commit: Harald Judt <h.judt@gmx.at>

    Rename all occurrences of find-duplicates to dired-duplicates
---
 README.org          |  10 ++---
 dired-duplicates.el | 118 ++++++++++++++++++++++++++--------------------------
 2 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/README.org b/README.org
index f04d3e18b6..abece490f4 100644
--- a/README.org
+++ b/README.org
@@ -1,4 +1,4 @@
-#+title: find-duplicates - Find duplicate files on local and remote filesystems
+#+title: dired-duplicates - Find duplicate files on local and remote 
filesystems
 
 * Description
 This Emacs package helps to find duplicate files on local and remote
@@ -6,7 +6,7 @@ filesystems.  It is similar to the fdupes command-line utility 
but written in
 Emacs Lisp and should also work on every remote filesystem that TRAMP supports
 and where executable commands can be called remotely.
 
-find-duplicates works by first searching files of the same size, then invoking
+dired-duplicates works by first searching files of the same size, then invoking
 the calculation of the checksum for these files, and finally presenting the
 grouped results in a Dired buffer that the user can work with similarly to a
 regular Dired buffer.  It might be even possible to combine this with other
@@ -23,16 +23,16 @@ checksum program can be customized.
 The package can be installed via the Emacs package manager,
 e.g. ~package-install~.  Or you use the following use-package snippet:
 #+BEGIN_SRC emacs-lisp
-(use-package find-duplicates)
+(use-package dired-duplicates)
 #+END_SRC
 
 * Usage
-Call ~find-duplicates-dired~ interactively and provide one or more directories
+Call ~dired-duplicates~ interactively and provide one or more directories
 (usually separated by commas) to search in recursively.
 
 * Configuration
 You can find all available customization options with ~customize-group~,
-entering =find-duplicates= for the desired group.  These options are described
+entering =dired-duplicates= for the desired group.  These options are described
 extensively there.
 
 * License
diff --git a/dired-duplicates.el b/dired-duplicates.el
index b35c651470..e479c602d6 100644
--- a/dired-duplicates.el
+++ b/dired-duplicates.el
@@ -1,4 +1,4 @@
-;;; find-duplicates.el --- Find duplicate files locally and remotely  -*- 
lexical-binding: t; -*-
+;;; dired-duplicates.el --- Find duplicate files locally and remotely  -*- 
lexical-binding: t; -*-
 
 ;; Copyright (C) 2022 Harald Judt
 
@@ -8,7 +8,7 @@
 ;; Version: 0.1
 ;; Package-Requires: ((emacs "27.1"))
 ;; Keywords: files
-;; Homepage: https://codeberg.org/hjudt/find-duplicates
+;; Homepage: https://codeberg.org/hjudt/dired-duplicates
 
 ;; This file is not part of GNU Emacs.
 
@@ -35,7 +35,7 @@
 ;; hash value from the contents of a file used for comparison, because Emacs
 ;; cannot do that in a performance-efficient way.
 ;;
-;; find-duplicates works by first searching files of the same size, then
+;; dired-duplicates works by first searching files of the same size, then
 ;; invoking the calculation of the checksum for these files, and presents the
 ;; grouped results in a Dired buffer that the user can work with similarly to
 ;; a regular Dired buffer.
@@ -45,76 +45,76 @@
 (require 'cl-lib)
 (require 'dired)
 
-(defgroup find-duplicates
+(defgroup dired-duplicates
   nil
   "Find duplicate files on local and/or remote filesystems."
-  :tag "Find Duplicate Files"
+  :tag "Dired Duplicates"
   :group 'dired)
 
-(defcustom find-duplicates-use-separators
+(defcustom dired-duplicates-use-separators
   t
   "Whether to use a separator dummy file for separating search results."
-  :group 'find-duplicates
+  :group 'dired-duplicates
   :tag "Separate search results"
   :type 'boolean)
 
-(defcustom find-duplicates-separator-file
+(defcustom dired-duplicates-separator-file
   (concat (temporary-file-directory) (make-string 40 ?-))
   "Path and name of the separator file.
 
 This file is used for making search results easier to discern.
 It will be created immediately before and deleted as soon as
 possible after the search operation finishes."
-  :group 'find-duplicates
+  :group 'dired-duplicates
   :tag "Separator dummy file"
   :type 'string)
 
-(defcustom find-duplicates-checksum-exec
+(defcustom dired-duplicates-checksum-exec
   "sha256sum"
   "Name of the executable used for creating file checksums.
 
 The checksums will be used for comparison of files of the same
 size."
-  :group 'find-duplicates
+  :group 'dired-duplicates
   :tag "Checksum executable"
   :type 'string)
 
-(defcustom find-duplicates-size-comparison-function
+(defcustom dired-duplicates-size-comparison-function
   '<
   "The comparison function used for sorting grouped results.
 
 The sorting can be in ascending (<) or descending (>) order."
-  :group 'find-duplicates
+  :group 'dired-duplicates
   :tag "Ascending or descending file size sort order"
   :type '(choice (const :tag "Ascending" :value <)
                  (const :tag "Descending" :value >)))
 
-(defcustom find-duplicates-file-filter-functions
+(defcustom dired-duplicates-file-filter-functions
   nil
   "Filter functions applied to all files found in a directory.
 
 A filter function must accept as its single argument the file and
 return boolean t if the file matches a criteria, otherwise nil."
-  :group 'find-duplicates
+  :group 'dired-duplicates
   :tag "File filter functions"
   :type 'hook)
 
-(defcustom find-duplicates-search-directories-recursively
+(defcustom dired-duplicates-search-directories-recursively
   t
   "Search directories recursively."
-  :group 'find-duplicates
+  :group 'dired-duplicates
   :tag "Search directories recursively"
   :type 'boolean)
 
-(defvar find-duplicates-directories nil
+(defvar dired-duplicates-directories nil
   "List of directories that will be searched for duplicate files.")
 
-(defun find-duplicates-checksum-file (file)
+(defun dired-duplicates-checksum-file (file)
   "Create a checksum for FILE.
 
-The executable used is defined by `find-duplicates-checksum-exec'."
+The executable used is defined by `dired-duplicates-checksum-exec'."
   (let* ((default-directory (file-name-directory (expand-file-name file)))
-         (exec (executable-find find-duplicates-checksum-exec t)))
+         (exec (executable-find dired-duplicates-checksum-exec t)))
     (unless exec
       (user-error "Checksum program %s not found in exec-path" exec))
     (car (split-string
@@ -123,47 +123,47 @@ The executable used is defined by 
`find-duplicates-checksum-exec'."
           nil
           t))))
 
-(defun find-duplicates--ensure-separator-file ()
+(defun dired-duplicates--ensure-separator-file ()
   "Ensure that the separator file exists.
 
-The file is specified by `find-duplicates-separator-file'."
-  (unless (file-exists-p find-duplicates-separator-file)
-    (make-empty-file find-duplicates-separator-file)))
+The file is specified by `dired-duplicates-separator-file'."
+  (unless (file-exists-p dired-duplicates-separator-file)
+    (make-empty-file dired-duplicates-separator-file)))
 
-(defun find-duplicates--remove-separator-file ()
-  "Remove the separator file specified by `find-duplicates-separator-file'."
-  (when (file-exists-p find-duplicates-separator-file)
-    (delete-file find-duplicates-separator-file nil)))
+(defun dired-duplicates--remove-separator-file ()
+  "Remove the separator file specified by `dired-duplicates-separator-file'."
+  (when (file-exists-p dired-duplicates-separator-file)
+    (delete-file dired-duplicates-separator-file nil)))
 
-(defmacro find-duplicates-with-separator-file (&rest body)
+(defmacro dired-duplicates-with-separator-file (&rest body)
   "Ensure separator file gets created and cleaned up before and after BODY."
   `(unwind-protect
        (progn
-         (when find-duplicates-use-separators
-           (find-duplicates--ensure-separator-file))
+         (when dired-duplicates-use-separators
+           (dired-duplicates--ensure-separator-file))
          ,@body)
-     (when find-duplicates-use-separators
-       (find-duplicates--remove-separator-file))))
+     (when dired-duplicates-use-separators
+       (dired-duplicates--remove-separator-file))))
 
-(defun find-duplicates--apply-file-filter-functions (files)
+(defun dired-duplicates--apply-file-filter-functions (files)
   "Apply file filter functions to FILES, returning the resulting list."
-  (if (and find-duplicates-file-filter-functions files)
-      (dolist (filter-func find-duplicates-file-filter-functions files)
+  (if (and dired-duplicates-file-filter-functions files)
+      (dolist (filter-func dired-duplicates-file-filter-functions files)
         (setf files (cl-delete-if-not filter-func files)))
     files))
 
-(defun find-duplicates--find-and-filter-files (directories)
+(defun dired-duplicates--find-and-filter-files (directories)
   "Search below DIRECTORIES for duplicate files.
 
 It is possible to provide one or more root DIRECTORIES.  Returns
 a hash-table with the checksums as keys and a list of size and
 duplicate files as values."
-  (cl-loop with files = (find-duplicates--apply-file-filter-functions
+  (cl-loop with files = (dired-duplicates--apply-file-filter-functions
                          (mapcan
                           (lambda (d)
-                              (if 
find-duplicates-search-directories-recursively
-                                  (directory-files-recursively d ".*")
-                                (cl-remove-if #'file-directory-p 
(directory-files d t nil t))))
+                            (if dired-duplicates-search-directories-recursively
+                                (directory-files-recursively d ".*")
+                              (cl-remove-if #'file-directory-p 
(directory-files d t nil t))))
                           (if (listp directories)
                               directories
                             (list directories))))
@@ -177,7 +177,7 @@ duplicate files as values."
            (cl-loop for same-size-files being the hash-values in 
same-size-table
                     if (> (length same-size-files) 1) do
                     (cl-loop for f in same-size-files
-                             for checksum = (find-duplicates-checksum-file f)
+                             for checksum = (dired-duplicates-checksum-file f)
                              do (setf (gethash checksum checksum-table)
                                       (append (gethash checksum 
checksum-table) (list f)))))
            (cl-loop for same-files being the hash-value in checksum-table 
using (hash-key checksum)
@@ -189,24 +189,24 @@ duplicate files as values."
                       (remhash checksum checksum-table)))
            (cl-return checksum-table)))
 
-(defun find-duplicates--generate-dired-list (&optional directories)
+(defun dired-duplicates--generate-dired-list (&optional directories)
   "Generate a list of grouped duplicate files in DIRECTORIES.
 
 Optionally they can be separated by a separator file specified by
-`find-duplicates-separator-file'."
-  (cl-loop with dupes-table = (find-duplicates--find-and-filter-files
+`dired-duplicates-separator-file'."
+  (cl-loop with dupes-table = (dired-duplicates--find-and-filter-files
                                (or directories
-                                   find-duplicates-directories))
+                                   dired-duplicates-directories))
            with sorted-sums = (cl-sort
                                (cl-loop for k being the hash-key in 
dupes-table using (hash-value v)
                                         collect (list k (car v)))
-                               find-duplicates-size-comparison-function
+                               dired-duplicates-size-comparison-function
                                :key #'cl-second)
            for (checksum) in sorted-sums
            append (cdr (gethash checksum dupes-table))
-           when find-duplicates-use-separators append (list 
find-duplicates-separator-file)))
+           when dired-duplicates-use-separators append (list 
dired-duplicates-separator-file)))
 
-(defun find-duplicates-dired-revert (&optional arg noconfirm)
+(defun dired-duplicates-dired-revert (&optional arg noconfirm)
   "Revert function used instead of `dired-revert' for Dired buffers.
 
 The args ARG and NOCONFIRM are passed through from
@@ -214,13 +214,13 @@ The args ARG and NOCONFIRM are passed through from
   (message "Looking for remaining duplicate files...")
   (setq-local dired-directory
               (append (list (car dired-directory))
-                      (find-duplicates--generate-dired-list)))
+                      (dired-duplicates--generate-dired-list)))
   (message "Reverting buffer complete.")
-  (find-duplicates-with-separator-file
+  (dired-duplicates-with-separator-file
    (dired-revert arg noconfirm)))
 
 ;;;###autoload
-(defun find-duplicates-dired (directories)
+(defun dired-duplicates (directories)
   "Find a list of duplicate files inside one or more DIRECTORIES.
 
 The results will be shown in a Dired buffer."
@@ -234,15 +234,15 @@ The results will be shown in a Dired buffer."
   (let ((default-directory "/")
         (truncated-dirs (truncate-string-to-width (string-join directories ", 
") 40 0 nil t)))
     (message "Finding duplicate files in %s..." truncated-dirs)
-    (if-let ((results (find-duplicates--generate-dired-list directories)))
+    (if-let ((results (dired-duplicates--generate-dired-list directories)))
         (progn
           (message "Finding duplicate files in %s completed." truncated-dirs)
-          (find-duplicates-with-separator-file
+          (dired-duplicates-with-separator-file
            (dired (cons "/" results))
-           (setq-local find-duplicates-directories directories)
-           (setq-local revert-buffer-function 'find-duplicates-dired-revert)))
+           (setq-local dired-duplicates-directories directories)
+           (setq-local revert-buffer-function 'dired-duplicates-dired-revert)))
       (message "No duplicate files found in %s." truncated-dirs))))
 
-(provide 'find-duplicates)
+(provide 'dired-duplicates)
 
-;;; find-duplicates.el ends here
+;;; dired-duplicates.el ends here



reply via email to

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