diff --git a/lisp/find-dired.el b/lisp/find-dired.el index 2c76179da0..c563ae533a 100644 --- a/lisp/find-dired.el +++ b/lisp/find-dired.el @@ -51,19 +51,23 @@ find-exec-terminator :group 'find-dired :type 'string) +(defvar find-ls-option-default-ls + (cons "-ls" (if (eq system-type 'berkeley-unix) "-gilsb" "-dilsb"))) + +(defvar find-ls-option-default-exec + (cons (format "-exec ls -ld {} %s" find-exec-terminator) "-ld")) + +(defvar find-ls-option-default-xargs + (cons "-print0 | sort -z | xargs -0 -e ls -ld" "-ld")) + ;; find's -ls corresponds to these switches. ;; Note -b, at least GNU find quotes spaces etc. in filenames (defcustom find-ls-option (if (eq 0 (ignore-errors (process-file find-program nil nil nil null-device "-ls"))) - (cons "-ls" - (if (eq system-type 'berkeley-unix) - "-gilsb" - "-dilsb")) - (cons - (format "-exec ls -ld {} %s" find-exec-terminator) - "-ld")) + find-ls-option-default-ls + find-ls-option-default-exec) "A pair of options to produce and parse an `ls -l'-type list from `find'. This is a cons of two strings (FIND-OPTION . LS-SWITCHES). FIND-OPTION is the option (or options) passed to `find' to produce @@ -78,9 +82,20 @@ find-ls-option (\"-ls\" . \"-dilsb\") since GNU find's output has the same format as using GNU ls with the options \"-dilsb\"." - :version "24.1" ; add tests for -ls and -exec + support - :type '(cons (string :tag "Find Option") - (string :tag "Ls Switches")) + :version "27.1" ; add choice of predefined set of options + :type `(choice + (cons :tag "find -ls" + (string ,(car find-ls-option-default-ls)) + (string ,(cdr find-ls-option-default-ls))) + (cons :tag "find -exec ls -ld" + (string ,(car find-ls-option-default-exec)) + (string ,(cdr find-ls-option-default-exec))) + (cons :tag "find -print | sort | xargs" + (string ,(car find-ls-option-default-xargs)) + (string ,(cdr find-ls-option-default-xargs))) + (cons :tag "Other values" + (string :tag "Find Option") + (string :tag "Ls Switches"))) :group 'find-dired) (defcustom find-ls-subdir-switches