Subject: Re: bug#67028: 29.1; WDired should restore the previous `mode-name' when returning to Dired mode

From: Eli Zaretskii <[email-masked]>
Date: Fri, 10 Nov 2023 10:09:35 +0200

> From: Drew Adams <[email-masked]>
> Date: Thu, 9 Nov 2023 20:00:25 +0000
> 
> Dunno how simple and sure this would be to do, but I think that when you
> quit WDired the mode-line should show the same `mode-name' it showed
> before you entered WDired.  E.g., if the `mode-name' was "Dired by name"
> then it should be restored to that.
> 
> Instead, when you quit WDired the `mode-name' is always set to just
> "Dired".  You lose the info that the sorting is by name or by date.

Thanks.  Does the patch below give good results?

diff --git a/lisp/wdired.el b/lisp/wdired.el
index 7b9c75d..079d93d 100644
--- a/lisp/wdired.el
+++ b/lisp/wdired.el
@@ -453,7 +453,7 @@ wdired-change-to-dired-mode
   (force-mode-line-update)
   (setq buffer-read-only t)
   (setq major-mode 'dired-mode)
-  (setq mode-name "Dired")
+  (dired-sort-set-mode-line)
   (dired-advertise)
   (dired-hide-details-update-invisibility-spec)
   (remove-hook 'kill-buffer-hook #'wdired-check-kill-buffer t)