aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorKarl Heuer1998-09-04 20:43:09 +0000
committerKarl Heuer1998-09-04 20:43:09 +0000
commit0b2bb4d096f59f7a0f99a3c68510b51f0a72a52c (patch)
tree3ff2e1014df587c5c05f8ce50acb0a90501920e3 /lisp
parent3827b1b8a29ffc9f0c1e715dbdc33c1c0af1d86d (diff)
downloademacs-0b2bb4d096f59f7a0f99a3c68510b51f0a72a52c.tar.gz
emacs-0b2bb4d096f59f7a0f99a3c68510b51f0a72a52c.zip
(dired-mark-files-containing-regexp):
Don't use find-file; instead, insert the file in a temp buffer.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/dired.el21
1 files changed, 12 insertions, 9 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index 19d0b104ac8..a9afa3e11e3 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2165,17 +2165,20 @@ 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 (save-excursion 2168 (and fn (let ((prebuf (get-file-buffer fn)))
2169 (message "Checking %s" fn)
2169 ;; For now we do it inside emacs 2170 ;; For now we do it inside emacs
2170 ;; Grep might be better if there are a lot of files 2171 ;; Grep might be better if there are a lot of files
2171 (message "Checking %s" fn) 2172 (if prebuf
2172 (let* ((prebuf (get-file-buffer fn))) 2173 (with-current-buffer prebuf
2173 (find-file fn) 2174 (save-excursion
2174 (goto-char (point-min)) 2175 (goto-char (point-min))
2175 (prog1 2176 (re-search-forward regexp nil t)))
2176 (re-search-forward regexp nil t) 2177 (with-temp-buffer
2177 (if (not prebuf) (kill-buffer nil)))) 2178 (insert-buffer-contents fn)
2178 )))) 2179 (goto-char (point-min))
2180 (re-search-forward regexp nil t))))
2181 )))
2179 "matching file"))) 2182 "matching file")))
2180 2183
2181(defun dired-flag-files-regexp (regexp) 2184(defun dired-flag-files-regexp (regexp)