# HG changeset patch # User Karl Heuer # Date 904941789 0 # Node ID c8b236bbecad2364e12ff7cc3f3fc9a61315a334 # Parent 205f3fab9564ba47f46d0e3f7e34a8d63105ecb4 (dired-mark-files-containing-regexp): Don't use find-file; instead, insert the file in a temp buffer. diff -r 205f3fab9564 -r c8b236bbecad lisp/dired.el --- a/lisp/dired.el Fri Sep 04 20:41:33 1998 +0000 +++ b/lisp/dired.el Fri Sep 04 20:43:09 1998 +0000 @@ -2165,17 +2165,20 @@ (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)