]> git.eshelyaron.com Git - emacs.git/commitdiff
(dired-mark-files-containing-regexp):
authorKarl Heuer <kwzh@gnu.org>
Fri, 4 Sep 1998 20:43:09 +0000 (20:43 +0000)
committerKarl Heuer <kwzh@gnu.org>
Fri, 4 Sep 1998 20:43:09 +0000 (20:43 +0000)
Don't use find-file; instead, insert the file in a temp buffer.

lisp/dired.el

index 19d0b104ac8fc16c0afcf03e2e00f4de3e9d4527..a9afa3e11e37f8adef239eac62c9b18fc21f8a6b 100644 (file)
@@ -2165,17 +2165,20 @@ 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 (save-excursion
+           (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
-                     (message "Checking %s" fn)
-                     (let* ((prebuf (get-file-buffer fn)))
-                       (find-file fn)
-                       (goto-char (point-min))
-                       (prog1 
-                           (re-search-forward regexp nil t)
-                         (if (not prebuf) (kill-buffer nil))))
-                     ))))
+                     (if prebuf
+                         (with-current-buffer prebuf
+                           (save-excursion
+                             (goto-char (point-min))
+                             (re-search-forward regexp nil t)))
+                       (with-temp-buffer
+                         (insert-buffer-contents fn)
+                         (goto-char (point-min))
+                         (re-search-forward regexp nil t))))
+                     )))
      "matching file")))
 
 (defun dired-flag-files-regexp (regexp)