Subject: bug#56423: 29.0.50; Hi-lock in dired broken by toggling wdired-mode

From: Eli Zaretskii <[email-masked]>
Date: Thu, 07 Jul 2022 08:35:20 +0300

> From: Michael Heerdegen <[email-masked]>
> Date: Wed, 06 Jul 2022 21:19:35 +0200
> 
> diff --git a/lisp/wdired.el b/lisp/wdired.el
> index a5858ed190..7c8969431f 100644
> --- a/lisp/wdired.el
> +++ b/lisp/wdired.el
> @@ -261,6 +261,7 @@ wdired-change-to-wdired-mode
>    (add-hook 'before-change-functions #'wdired--before-change-fn nil t)
>    (add-hook 'after-change-functions #'wdired--restore-properties nil t)
>    (setq major-mode 'wdired-mode)
> +  (setq font-lock-major-mode 'wdired-mode)
>    (setq mode-name "Editable Dired")
>    (add-function :override (local 'revert-buffer-function) #'wdired-revert)
>    (set-buffer-modified-p nil)
> @@ -457,6 +458,7 @@ wdired-change-to-dired-mode
>    (force-mode-line-update)
>    (setq buffer-read-only t)
>    (setq major-mode 'dired-mode)
> +  (setq font-lock-major-mode 'dired-mode)
>    (setq mode-name "Dired")
>    (dired-advertise)
>    (remove-hook 'kill-buffer-hook #'wdired-check-kill-buffer t)

Don't we need to make sure font-lock-major-mode is restored no matter
how wdired is exited, whether normally or abnormally?

I'm not too familiar with wdired, so apologies if what I said makes no
sense.