all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tino Calancha <f92capac@gmail.com>
To: 22694@debbugs.gnu.org
Cc: Tino Calancha <f92capac@gmail.com>
Subject: bug#22694: 25.0.91; dired-mark-files-containing-regexp read file disk
Date: Wed, 24 Feb 2016 18:31:53 +0900 (JST)	[thread overview]
Message-ID: <alpine.LRH.2.20.1602241830060.17491@calancha-ilc.kek.jp> (raw)
In-Reply-To: <alpine.LRH.2.20.1602162134160.6276@calancha-ilc.kek.jp>

[-- Attachment #1: Type: text/plain, Size: 165 bytes --]


I think is better to not use the buffer and always read the file.
This way we always mark all the files containing the regexp,
regardless of the user customization.

[-- Attachment #2: Type: text/plain, Size: 1226 bytes --]

diff --git a/lisp/dired.el b/lisp/dired.el
index 6c7445c..199e6ff 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3359,23 +3359,16 @@ dired-mark-files-containing-regexp
      (and (not (looking-at-p dired-re-dot))
 	  (not (eolp))			; empty line
 	  (let ((fn (dired-get-filename nil t)))
-	    (when (and fn (file-readable-p fn)
-		       (not (file-directory-p fn)))
-	      (let ((prebuf (get-file-buffer fn)))
+	    (when (and fn (file-regular-p fn)
+                   (file-readable-p fn))
 		(message "Checking %s" fn)
 		;; For now we do it inside emacs
 		;; Grep might be better if there are a lot of files
-		(if prebuf
-		    (with-current-buffer prebuf
-		      (save-excursion
-			(goto-char (point-min))
-			(re-search-forward regexp nil t)))
-		  (with-temp-buffer
-		    (insert-file-contents fn)
-		    (goto-char (point-min))
-		    (re-search-forward regexp nil t))))
-		      )))
-     "matching file")))
+		(with-temp-buffer
+		  (insert-file-contents fn)
+		  (goto-char (point-min))
+		  (re-search-forward regexp nil t)))))
+	"matching file")))
 
 (defun dired-flag-files-regexp (regexp)
   "In Dired, flag all files containing the specified REGEXP for deletion.

  parent reply	other threads:[~2016-02-24  9:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16 12:47 bug#22694: 25.0.91; dired-mark-files-containing-regexp read file disk Tino Calancha
2016-02-16 16:05 ` Eli Zaretskii
2016-02-17 14:07   ` Tino Calancha
2016-02-24  9:31 ` Tino Calancha [this message]
2016-04-10  7:02 ` Tino Calancha
2016-04-20 14:55   ` Eli Zaretskii
2016-04-20 15:31     ` Tino Calancha
2016-04-20 15:48       ` Eli Zaretskii
2016-06-26 15:32         ` Tino Calancha
2016-07-09 11:07           ` Eli Zaretskii
2016-07-11  5:48             ` Tino Calancha
2016-07-11  5:49 ` bug#22694: (no subject) Tino Calancha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LRH.2.20.1602241830060.17491@calancha-ilc.kek.jp \
    --to=f92capac@gmail.com \
    --cc=22694@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.