]> git.eshelyaron.com Git - emacs.git/commitdiff
(dired-mark-files-containing-regexp):
authorKarl Heuer <kwzh@gnu.org>
Thu, 10 Sep 1998 16:00:20 +0000 (16:00 +0000)
committerKarl Heuer <kwzh@gnu.org>
Thu, 10 Sep 1998 16:00:20 +0000 (16:00 +0000)
Don't scan directories.  Ignore non-readable files.

lisp/dired.el

index b5b3b8fc0783624f5d93b7c71f19babec696a4d2..4218f1050c45046babb78576cb5a24953c5806b2 100644 (file)
@@ -2165,19 +2165,21 @@ A prefix argument means to unmark them instead.
      (and (not (looking-at dired-re-dot))
          (not (eolp))                  ; empty line
          (let ((fn (dired-get-filename nil t)))
-           (and fn (let ((prebuf (get-file-buffer fn)))
-                     (message "Checking %s" fn)
-                     ;; For now we do it inside emacs
-                     ;; Grep might be better if there are a lot of files
-                     (if prebuf
-                         (with-current-buffer prebuf
-                           (save-excursion
-                             (goto-char (point-min))
-                             (re-search-forward regexp nil t)))
-                       (with-temp-buffer
-                         (insert-file-contents fn)
-                         (goto-char (point-min))
-                         (re-search-forward regexp nil t))))
+           (when (and fn (file-readable-p fn)
+                      (not (file-directory-p fn)))
+             (let ((prebuf (get-file-buffer fn)))
+               (message "Checking %s" fn)
+               ;; For now we do it inside emacs
+               ;; Grep might be better if there are a lot of files
+               (if prebuf
+                   (with-current-buffer prebuf
+                     (save-excursion
+                       (goto-char (point-min))
+                       (re-search-forward regexp nil t)))
+                 (with-temp-buffer
+                   (insert-file-contents fn)
+                   (goto-char (point-min))
+                   (re-search-forward regexp nil t))))
                      )))
      "matching file")))