From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#22694: 25.0.91; dired-mark-files-containing-regexp read file disk Date: Mon, 27 Jun 2016 00:32:18 +0900 (JST) Message-ID: References: <83twiw72k4.fsf@gnu.org> <83lh487036.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: ger.gmane.org 1466955214 21493 80.91.229.3 (26 Jun 2016 15:33:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 26 Jun 2016 15:33:34 +0000 (UTC) Cc: Tino Calancha , 22694@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jun 26 17:33:14 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bHC3d-0004Dh-S3 for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Jun 2016 17:33:14 +0200 Original-Received: from localhost ([::1]:54327 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHC3d-0004Ky-6d for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Jun 2016 11:33:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHC3W-0004Dj-JM for bug-gnu-emacs@gnu.org; Sun, 26 Jun 2016 11:33:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHC3S-0004ms-BE for bug-gnu-emacs@gnu.org; Sun, 26 Jun 2016 11:33:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44564) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHC3S-0004mo-7f for bug-gnu-emacs@gnu.org; Sun, 26 Jun 2016 11:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bHC3S-0003fg-0t for bug-gnu-emacs@gnu.org; Sun, 26 Jun 2016 11:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Jun 2016 15:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22694 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22694-submit@debbugs.gnu.org id=B22694.146695514914064 (code B ref 22694); Sun, 26 Jun 2016 15:33:01 +0000 Original-Received: (at 22694) by debbugs.gnu.org; 26 Jun 2016 15:32:29 +0000 Original-Received: from localhost ([127.0.0.1]:56901 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bHC2v-0003em-AA for submit@debbugs.gnu.org; Sun, 26 Jun 2016 11:32:29 -0400 Original-Received: from mail-pf0-f169.google.com ([209.85.192.169]:34824) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bHC2t-0003eY-KA for 22694@debbugs.gnu.org; Sun, 26 Jun 2016 11:32:28 -0400 Original-Received: by mail-pf0-f169.google.com with SMTP id c2so53742553pfa.2 for <22694@debbugs.gnu.org>; Sun, 26 Jun 2016 08:32:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=DNM+4mvoj5+5iBUePF9PVHQmXRapxXlbJCYVUUXLx3Q=; b=KQnYI+Rp3rSbly/isZ0Ko07+/Gz8bJc2AERtkElkZBHyE+r4WPgwe8UaDV62UyzLDr gjhg+j0oUIvbElmK9LEXAfGWiBIz50n8sTN8BCGY35VLX3i9puxM5ITwShOnQjZuK6/g G5VhrCur5lakgIh4faWh8puFTykvgkAWLzTrbfkibAjrPg3Tr6+rvSZfrLzZ87wwNs6n Oinhx7wYrA08EP7WNL4e7pL9nUAmaeFbt0BHG09pht1TlokMk/xUoKVLGqN0hVEasAj6 4SlijOdGpT8ZANSnvz5M1+z2WAZHjLS7zGw/zI0yU034FOn9byVIAQLvawRodMc6J33h EQaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=DNM+4mvoj5+5iBUePF9PVHQmXRapxXlbJCYVUUXLx3Q=; b=Rk/7AJS/MJ99z7FiG+kfbeVoBDuFuXhqlUzrRFg3NvWnkQmaENFiKJujevDe9UvIJK 2sP9DyNuCa6G7X6KSlvbb3/JoZyVLXcg7UaWA1TwMYTolu89MEWpEM40cyMfoTLT2Qa4 bX3UFPFRHqVgF/J1oAUlp+Wg1gZ/GcFb5llkzCRza3aegm8wnq5zugSX/uLk52rhOT2d c5BroxVbUgNzFNSoTo8z4TURmsXIw8bArOl+0VNk1vojS8iudKu3LL0lre7qQo5ibEsc cT3ktAjmiXM2ar80e8bNX4xTJEFsPxy3Gp2VicF8FGIAM8Gx3qXU/CZ7HZMCXlDtPCgF SlDQ== X-Gm-Message-State: ALyK8tI+d5F/0XJPjn/OI48Y+sGtQEpFLnxG60PrgeiLDs7zoswvByayPa9t2WdkS0z3pw== X-Received: by 10.98.50.1 with SMTP id y1mr25173298pfy.120.1466955141838; Sun, 26 Jun 2016 08:32:21 -0700 (PDT) Original-Received: from calancha-pc (softbank126103139048.bbtec.net. [126.103.139.48]) by smtp.gmail.com with ESMTPSA id y10sm476938pas.24.2016.06.26.08.32.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Jun 2016 08:32:21 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: <83lh487036.fsf@gnu.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:120099 Archived-At: On Wed, 20 Apr 2016, Eli Zaretskii wrote: >I guess we could have an option to switch to the behavior you would >like to see, but such an option, if we introduce it, IMO should not be >specific to this command, it should affect all the Dired commands >which might produce different results when buffers are not >auto-reverted. I have only found another Dired command which might require the new option: `dired-do-query-replace-regexp'. But it seems unnecessary because this command already alert the user if the file has being modified 'externally': ./emacs -Q -eval '(progn (with-temp-file "/tmp/foo" (insert "foobar")) (find-file "/tmp/foo") (dired "/tmp"))' % g \`foobar$ RET M-! echo foo > foo M-x dired-do-query-replace-regexp RET \`foobar$ RET bar RET ;; File foo changed on disk. Reread from disk? (yes or no) ;;; So i propose a patch which: 1) Adds a new option `dired-always-read-filesystem' (default value nil). 2) Use it just in `dired-mark-files-containing-regexp'. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From e6449456c023e86511cd09dbcacefba471c5f1d5 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Mon, 27 Jun 2016 00:10:57 +0900 Subject: [PATCH] Dired always read file system * dired.el (dired-always-read-filesystem): Add new option. (dired-mark-files-containing-regexp): Use it (Bug#22694). * doc/emacs/dired.texi: Mention it in the manual. ; * etc/NEWS: Add entry for this change. --- doc/emacs/dired.texi | 7 +++++-- etc/NEWS | 3 +++ lisp/dired.el | 14 ++++++++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi index 486e92a..763c1f5 100644 --- a/doc/emacs/dired.texi +++ b/doc/emacs/dired.texi @@ -550,13 +550,16 @@ Marks vs Flags the regular expression @var{regexp} (@code{dired-mark-files-containing-regexp}). This command is like @kbd{% m}, except that it searches the file contents instead of the file -name. Note that if a file is visited in an Emacs buffer, this command +name. Note that if a file is visited in an Emacs buffer, +and @code{dired-always-read-filesystem} evaluates @code{nil}, this command will look in the buffer without revisiting the file, so the results might be inconsistent with the file on disk if its contents has changed since it was last visited. If you don't want this, you may wish reverting the files you have visited in your buffers, or turning on the @code{auto-revert} mode in those buffers, before invoking this -command. @xref{Reverting}. +command. @xref{Reverting}. If you prefer that this command always revisit +the file, without having to revert the file or enable @code{auto-revert} +mode, you might want to set @code{dired-always-read-filesystem} to non-@code{nil}. @item C-/ @itemx C-x u diff --git a/etc/NEWS b/etc/NEWS index b3a044d..6683199 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -198,6 +198,9 @@ questions, with a handy way to display help texts. ** Dired +++ +*** New option 'dired-always-read-filesystem'. + ++++ *** In wdired, when editing files to contain slash characters, the resulting directories are automatically created. Whether to do this is controlled by the 'wdired-create-parent-directories' variable. diff --git a/lisp/dired.el b/lisp/dired.el index 38979b5..7eb6216 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -255,6 +255,15 @@ dired-hide-details-hide-information-lines :version "24.4" :group 'dired) +(defcustom dired-always-read-filesystem nil + "Non-nil means commands like `dired-mark-files-containing-regexp' which +may use a buffer visiting the file or read the file on disk, always +read the file system. Otherwise, if do exist a buffer visiting the file, +then use that buffer." + :type 'boolean + :version "25.2" + :group 'dired) + ;; Internal variables (defvar dired-marker-char ?* ; the answer is 42 @@ -3359,7 +3368,8 @@ dired-mark-files-containing-regexp A prefix argument means to unmark them instead. `.' and `..' are never marked. -Note that if a file is visited in an Emacs buffer, this command will +Note that if a file is visited in an Emacs buffer, and +`dired-always-read-filesystem' evaluates nil, this command will look in the buffer without revisiting the file, so the results might be inconsistent with the file on disk if its contents has changed since it was last visited." @@ -3379,7 +3389,7 @@ dired-mark-files-containing-regexp (message "Checking %s" fn) ;; For now we do it inside emacs ;; Grep might be better if there are a lot of files - (if prebuf + (if (and prebuf (not dired-always-read-filesystem)) (with-current-buffer prebuf (save-excursion (goto-char (point-min)) -- 2.8.1 In GNU Emacs 25.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.20.6) Repository revision: 8419f0d166cf5107062ff74f120c591f3fce35d9