all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#22694: 25.0.91; dired-mark-files-containing-regexp read file disk
@ 2016-02-16 12:47 Tino Calancha
  2016-02-16 16:05 ` Eli Zaretskii
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Tino Calancha @ 2016-02-16 12:47 UTC (permalink / raw)
  To: 22694

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


When a buffer visiting the file on disk exists, the matching is performed 
on this buffer: if the buffer is out of sync with the file, the
result may be wrong.

emacs -Q /tmp/foo --eval='(progn (with-current-buffer "foo" (insert "baz")) (save-buffer))'
C-x d RET
M-! printf baz >> bar; for f in foo bar; do printf qux >> $f ; done RET
g
% g \`bazqux$ RET
;; Just match bar.  It may signal an error if trying to read a non regular file.


*) Files satisfying predicate `file-regular-p'.
*) A buffer visiting the file on disk need to be updated before matching the input regexp.

In GNU Emacs 25.0.91.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23)
Repository revision: b1a3ebedba88689d26f44cf7db338104b849ae99

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

diff --git a/lisp/dired.el b/lisp/dired.el
index 24b128f..f42040d 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3355,8 +3355,8 @@ 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)))
+	    (when (and fn (file-regular-p fn)
+		       (file-readable-p fn))
 	      (let ((prebuf (get-file-buffer fn)))
 		(message "Checking %s" fn)
 		;; For now we do it inside emacs
@@ -3364,6 +3364,7 @@ dired-mark-files-containing-regexp
 		(if prebuf
 		    (with-current-buffer prebuf
 		      (save-excursion
+            (revert-buffer t t t)
 			(goto-char (point-min))
 			(re-search-forward regexp nil t)))
 		  (with-temp-buffer

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-07-11  5:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.