Mercurial > emacs
comparison lisp/find-dired.el @ 79588:7f97528cec7f
(find-name-arg): New custom variable.
(find-name-dired): Use it.
(find-dired-find-program): Remove.
(find-dired): Use find-program.
(find-grep-dired): Use grep-program.
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Fri, 21 Dec 2007 10:32:38 +0000 |
parents | 9355f9b7bbff |
children | 73661ddc7ac7 56a72e2bd635 |
comparison
equal
deleted
inserted
replaced
79587:9a307d915ad7 | 79588:7f97528cec7f |
---|---|
33 | 33 |
34 (defgroup find-dired nil | 34 (defgroup find-dired nil |
35 "Run a `find' command and dired the output." | 35 "Run a `find' command and dired the output." |
36 :group 'dired | 36 :group 'dired |
37 :prefix "find-") | 37 :prefix "find-") |
38 | |
39 (defcustom find-dired-find-program "find" | |
40 "Program used to find files." | |
41 :group 'dired | |
42 :type 'file) | |
43 | 38 |
44 ;; find's -ls corresponds to these switches. | 39 ;; find's -ls corresponds to these switches. |
45 ;; Note -b, at least GNU find quotes spaces etc. in filenames | 40 ;; Note -b, at least GNU find quotes spaces etc. in filenames |
46 ;;;###autoload | 41 ;;;###autoload |
47 (defcustom find-ls-option | 42 (defcustom find-ls-option |
74 "*Option to grep to be as silent as possible. | 69 "*Option to grep to be as silent as possible. |
75 On Berkeley systems, this is `-s'; on Posix, and with GNU grep, `-q' does it. | 70 On Berkeley systems, this is `-s'; on Posix, and with GNU grep, `-q' does it. |
76 On other systems, the closest you can come is to use `-l'." | 71 On other systems, the closest you can come is to use `-l'." |
77 :type 'string | 72 :type 'string |
78 :group 'find-dired) | 73 :group 'find-dired) |
74 | |
75 ;;;###autoload | |
76 (defcustom find-name-arg | |
77 (if read-file-name-completion-ignore-case | |
78 "-iname" | |
79 "-name") | |
80 "*Argument used to specify file name pattern. | |
81 If `read-file-name-completion-ignore-case' is non-nil, -iname is used so that | |
82 find also ignores case. Otherwise, -name is used." | |
83 :type 'string | |
84 :group 'find-dired | |
85 :version "22.2") | |
79 | 86 |
80 (defvar find-args nil | 87 (defvar find-args nil |
81 "Last arguments given to `find' by \\[find-dired].") | 88 "Last arguments given to `find' by \\[find-dired].") |
82 | 89 |
83 ;; History of find-args values entered in the minibuffer. | 90 ;; History of find-args values entered in the minibuffer. |
124 (kill-all-local-variables) | 131 (kill-all-local-variables) |
125 (setq buffer-read-only nil) | 132 (setq buffer-read-only nil) |
126 (erase-buffer) | 133 (erase-buffer) |
127 (setq default-directory dir | 134 (setq default-directory dir |
128 find-args args ; save for next interactive call | 135 find-args args ; save for next interactive call |
129 args (concat find-dired-find-program " . " | 136 args (concat find-program " . " |
130 (if (string= args "") | 137 (if (string= args "") |
131 "" | 138 "" |
132 (concat | 139 (concat |
133 (shell-quote-argument "(") | 140 (shell-quote-argument "(") |
134 " " args " " | 141 " " args " " |
196 The command run (after changing into DIR) is | 203 The command run (after changing into DIR) is |
197 | 204 |
198 find . -name 'PATTERN' -ls" | 205 find . -name 'PATTERN' -ls" |
199 (interactive | 206 (interactive |
200 "DFind-name (directory): \nsFind-name (filename wildcard): ") | 207 "DFind-name (directory): \nsFind-name (filename wildcard): ") |
201 (find-dired dir (concat "-name " (shell-quote-argument pattern)))) | 208 (find-dired dir (concat find-name-arg " " (shell-quote-argument pattern)))) |
202 | 209 |
203 ;; This functionality suggested by | 210 ;; This functionality suggested by |
204 ;; From: oblanc@watcgl.waterloo.edu (Olivier Blanc) | 211 ;; From: oblanc@watcgl.waterloo.edu (Olivier Blanc) |
205 ;; Subject: find-dired, lookfor-dired | 212 ;; Subject: find-dired, lookfor-dired |
206 ;; Date: 10 May 91 17:50:00 GMT | 213 ;; Date: 10 May 91 17:50:00 GMT |
220 ;; or we could use `grep -l >/dev/null' | 227 ;; or we could use `grep -l >/dev/null' |
221 ;; We use -type f, not ! -type d, to avoid getting screwed | 228 ;; We use -type f, not ! -type d, to avoid getting screwed |
222 ;; by FIFOs and devices. I'm not sure what's best to do | 229 ;; by FIFOs and devices. I'm not sure what's best to do |
223 ;; about symlinks, so as far as I know this is not wrong. | 230 ;; about symlinks, so as far as I know this is not wrong. |
224 (find-dired dir | 231 (find-dired dir |
225 (concat "-type f -exec grep " find-grep-options " -e " | 232 (concat "-type f -exec " grep-program " " find-grep-options " -e " |
226 (shell-quote-argument regexp) | 233 (shell-quote-argument regexp) |
227 " " | 234 " " |
228 (shell-quote-argument "{}") | 235 (shell-quote-argument "{}") |
229 " " | 236 " " |
230 (shell-quote-argument ";")))) | 237 (shell-quote-argument ";")))) |