Subject: Re: bug#71264: 30.0.50; Dired deletion moves point under auto-revert

From: Manuel Giraud <[email-masked]>
Date: Sat, 08 Jun 2024 18:11:53 +0200

Hi,

I don't know if this is the right approach but the following patch gives
me the expected behaviour.
>From 4aa18aa0e60a8af0bbc8d333fc5e07caf6b3ab0a Mon Sep 17 00:00:00 2001
From: Manuel Giraud <[email-masked]>
Date: Sat, 8 Jun 2024 18:08:28 +0200
Subject: [PATCH] Prevent auto-revert when deleting entry(bug#71264)

* lisp/dired.el (dired-internal-do-deletions): Temporarily
  prevent auto-revert.
---
 lisp/dired.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/dired.el b/lisp/dired.el
index c51e5e42c29..67683c4ab93 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -4015,7 +4015,11 @@ dired-internal-do-deletions
               (dired-move-to-filename)
 	      (let ((inhibit-read-only t))
 		(condition-case err
-		    (let ((fn (car (car l))))
+		    (let ((fn (car (car l)))
+                          ;; Temporarily prevent auto-revert while
+                          ;; deleting entry in the dired buffer.
+                          (auto-revert-mode nil)
+                          (dired-auto-revert-buffer nil))
 		      (dired-delete-file fn dired-recursive-deletes trash)
 		      ;; if we get here, removing worked
 		      (setq succ (1+ succ))
-- 
2.45.1

-- 
Manuel Giraud