emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 40d5ff01e51: Don't skip or double-process files in dired with aut


From: Tassilo Horn
Subject: master 40d5ff01e51: Don't skip or double-process files in dired with auto-revert-mode (bug#75626)
Date: Mon, 20 Jan 2025 11:54:12 -0500 (EST)

branch: master
commit 40d5ff01e51ed6319933e18df0fbe9ef55d9bece
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>

    Don't skip or double-process files in dired with auto-revert-mode 
(bug#75626)
    
    * lisp/dired.el (dired--inhibit-auto-revert): New variable.
    (dired-map-over-marks): Make the generated code bind it.
    (dired-buffer-stale-p): Return nil if dired--inhibit-auto-revert is
    non-nil.
---
 lisp/dired.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/lisp/dired.el b/lisp/dired.el
index 2087a6f6f21..d2071d80bf3 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -944,6 +944,9 @@ Return value is the number of files marked, or nil if none 
were marked."
                           ""))))
     (and (> count 0) count)))
 
+(defvar-local dired--inhibit-auto-revert nil
+  "A non-nil value prevents `auto-revert-mode' from reverting the buffer.")
+
 (defmacro dired-map-over-marks (body arg &optional show-progress
                                     distinguish-one-marked)
   "Eval BODY with point on each marked line.  Return a list of BODY's results.
@@ -980,7 +983,9 @@ marked file, return (t FILENAME) instead of (FILENAME)."
   ;;endless loop.
   ;;This warning should not apply any longer, sk  2-Sep-1991 14:10.
   `(prog1
-       (let ((inhibit-read-only t) case-fold-search found results)
+       (let ((dired--inhibit-auto-revert t)
+             (inhibit-read-only t)
+             case-fold-search found results)
         (if (and ,arg (not (eq ,arg 'marked)))
             (if (integerp ,arg)
                 (progn ;; no save-excursion, want to move point.
@@ -1289,6 +1294,12 @@ This feature is used by Auto Revert mode."
         ;; Do not auto-revert when the dired buffer can be currently
         ;; written by the user as in `wdired-mode'.
         buffer-read-only
+         ;; When a dired operation using dired-map-over-marks is in
+         ;; progress, dired--inhibit-auto-revert is bound to some
+         ;; non-nil value and we must not auto-revert because that could
+         ;; change the order of files leading to skipping or
+         ;; double-processing (see bug#75626).
+         (not dired--inhibit-auto-revert)
         (dired-directory-changed-p dirname))))
 
 (defcustom dired-auto-revert-buffer nil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]