72 |
;; History of find-args values entered in the minibuffer. |
;; History of find-args values entered in the minibuffer. |
73 |
(defvar find-args-history nil) |
(defvar find-args-history nil) |
74 |
|
|
75 |
|
(defvar dired-sort-inhibit) |
76 |
|
|
77 |
;;;###autoload |
;;;###autoload |
78 |
(defun find-dired (dir args) |
(defun find-dired (dir args) |
79 |
"Run `find' and go into Dired mode on a buffer of the output. |
"Run `find' and go into Dired mode on a buffer of the output. |
109 |
(delete-process find)) |
(delete-process find)) |
110 |
(error nil)) |
(error nil)) |
111 |
(error "Cannot have two processes in `%s' at once" (buffer-name))))) |
(error "Cannot have two processes in `%s' at once" (buffer-name))))) |
112 |
|
|
113 |
(widen) |
(widen) |
114 |
(kill-all-local-variables) |
(kill-all-local-variables) |
115 |
(setq buffer-read-only nil) |
(setq buffer-read-only nil) |
123 |
(car find-ls-option))) |
(car find-ls-option))) |
124 |
;; The next statement will bomb in classic dired (no optional arg allowed) |
;; The next statement will bomb in classic dired (no optional arg allowed) |
125 |
(dired-mode dir (cdr find-ls-option)) |
(dired-mode dir (cdr find-ls-option)) |
126 |
|
(make-local-variable 'dired-sort-inhibit) |
127 |
|
(setq dired-sort-inhibit t) |
128 |
(set (make-local-variable 'revert-buffer-function) |
(set (make-local-variable 'revert-buffer-function) |
129 |
`(lambda (ignore-auto noconfirm) |
`(lambda (ignore-auto noconfirm) |
130 |
(find-dired ,dir ,find-args))) |
(find-dired ,dir ,find-args))) |
134 |
;; and later) |
;; and later) |
135 |
(dired-simple-subdir-alist) |
(dired-simple-subdir-alist) |
136 |
;; else we have an ancient tree dired (or classic dired, where |
;; else we have an ancient tree dired (or classic dired, where |
137 |
;; this does no harm) |
;; this does no harm) |
138 |
(set (make-local-variable 'dired-subdir-alist) |
(set (make-local-variable 'dired-subdir-alist) |
139 |
(list (cons default-directory (point-min-marker))))) |
(list (cons default-directory (point-min-marker))))) |
140 |
(setq buffer-read-only nil) |
(setq buffer-read-only nil) |
142 |
;; subdir-alist points there. |
;; subdir-alist points there. |
143 |
(insert " " dir ":\n") |
(insert " " dir ":\n") |
144 |
;; Make second line a ``find'' line in analogy to the ``total'' or |
;; Make second line a ``find'' line in analogy to the ``total'' or |
145 |
;; ``wildcard'' line. |
;; ``wildcard'' line. |
146 |
(insert " " args "\n") |
(insert " " args "\n") |
147 |
;; Start the find process. |
;; Start the find process. |
148 |
(let ((proc (start-process-shell-command find-dired-find-program (current-buffer) args))) |
(let ((proc (start-process-shell-command find-dired-find-program (current-buffer) args))) |