(dired-mark-files-containing-regexp):

Don't use find-file; instead, insert the file in a temp buffer.
This commit is contained in:
Karl Heuer 1998-09-04 20:43:09 +00:00
parent 3827b1b8a2
commit 0b2bb4d096

View file

@ -2165,17 +2165,20 @@ A prefix argument means to unmark them instead.
(and (not (looking-at dired-re-dot)) (and (not (looking-at dired-re-dot))
(not (eolp)) ; empty line (not (eolp)) ; empty line
(let ((fn (dired-get-filename nil t))) (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 ;; For now we do it inside emacs
;; Grep might be better if there are a lot of files ;; Grep might be better if there are a lot of files
(message "Checking %s" fn) (if prebuf
(let* ((prebuf (get-file-buffer fn))) (with-current-buffer prebuf
(find-file fn) (save-excursion
(goto-char (point-min)) (goto-char (point-min))
(prog1 (re-search-forward regexp nil t)))
(re-search-forward regexp nil t) (with-temp-buffer
(if (not prebuf) (kill-buffer nil)))) (insert-buffer-contents fn)
)))) (goto-char (point-min))
(re-search-forward regexp nil t))))
)))
"matching file"))) "matching file")))
(defun dired-flag-files-regexp (regexp) (defun dired-flag-files-regexp (regexp)