Mercurial > emacs
comparison lisp/dired.el @ 23188:c8b236bbecad
(dired-mark-files-containing-regexp):
Don't use find-file; instead, insert the file in a temp buffer.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Fri, 04 Sep 1998 20:43:09 +0000 |
parents | 131d52d2656d |
children | 17a79bc7bfe1 |
comparison
equal
deleted
inserted
replaced
23187:205f3fab9564 | 23188:c8b236bbecad |
---|---|
2163 (let ((dired-marker-char (or marker-char dired-marker-char))) | 2163 (let ((dired-marker-char (or marker-char dired-marker-char))) |
2164 (dired-mark-if | 2164 (dired-mark-if |
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) |
2182 "In dired, flag all files containing the specified REGEXP for deletion. | 2185 "In dired, flag all files containing the specified REGEXP for deletion. |
2183 The match is against the non-directory part of the filename. Use `^' | 2186 The match is against the non-directory part of the filename. Use `^' |