aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1998-09-10 16:00:20 +0000
committerKarl Heuer1998-09-10 16:00:20 +0000
commit05a40373215e7995aec79d1b3b426a2d4504f67b (patch)
tree241381e9415a2f2de023df4304076b3289b813f7
parent5cfc5cbe700f876b50e8da095f47221ae70afa6e (diff)
downloademacs-05a40373215e7995aec79d1b3b426a2d4504f67b.tar.gz
emacs-05a40373215e7995aec79d1b3b426a2d4504f67b.zip
(dired-mark-files-containing-regexp):
Don't scan directories. Ignore non-readable files.
-rw-r--r--lisp/dired.el28
1 files changed, 15 insertions, 13 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index b5b3b8fc078..4218f1050c4 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2165,19 +2165,21 @@ A prefix argument means to unmark them instead.
2165 (and (not (looking-at dired-re-dot)) 2165 (and (not (looking-at dired-re-dot))
2166 (not (eolp)) ; empty line 2166 (not (eolp)) ; empty line
2167 (let ((fn (dired-get-filename nil t))) 2167 (let ((fn (dired-get-filename nil t)))
2168 (and fn (let ((prebuf (get-file-buffer fn))) 2168 (when (and fn (file-readable-p fn)
2169 (message "Checking %s" fn) 2169 (not (file-directory-p fn)))
2170 ;; For now we do it inside emacs 2170 (let ((prebuf (get-file-buffer fn)))
2171 ;; Grep might be better if there are a lot of files 2171 (message "Checking %s" fn)
2172 (if prebuf 2172 ;; For now we do it inside emacs
2173 (with-current-buffer prebuf 2173 ;; Grep might be better if there are a lot of files
2174 (save-excursion 2174 (if prebuf
2175 (goto-char (point-min)) 2175 (with-current-buffer prebuf
2176 (re-search-forward regexp nil t))) 2176 (save-excursion
2177 (with-temp-buffer 2177 (goto-char (point-min))
2178 (insert-file-contents fn) 2178 (re-search-forward regexp nil t)))
2179 (goto-char (point-min)) 2179 (with-temp-buffer
2180 (re-search-forward regexp nil t)))) 2180 (insert-file-contents fn)
2181 (goto-char (point-min))
2182 (re-search-forward regexp nil t))))
2181 ))) 2183 )))
2182 "matching file"))) 2184 "matching file")))
2183 2185