Subject: [PATCH 1/3] Remap read-only-mode in wdired-mode-map

From: Liam Hupfer <[email-masked]>
Date: Sun, 12 Jan 2025 19:00:34 -0600

dired-mode-map already remaps read-only-mode to dired-toggle-read-only.
Make wdired-mode-map remap as well, instead of hardcoding the default
C-x C-q.

* lisp/wdired.el (wdired-mode-map): Remap read-only-mode to wdired-exit.
* etc/NEWS (Dired): Document remap.
---
 etc/NEWS       | 6 ++++++
 lisp/wdired.el | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index d017c872fa3..220730c2cc0 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -785,6 +785,12 @@ Without 'dired-hide-details-hide-absolute-location':
 When 'dired-make-directory-clickable' is non-nil, clicking on the base
 name of the directory now reverts the Dired buffer.
 
+---
+*** wdired-exit binding now respects changes to read-only-mode.
+Previously 'wdired-mode-map' bound 'wdired-exit' to 'C-x C-q'. Now a
+remap of 'read-only-mode' is used. This matches Dired's
+'wdired-change-to-wdired-mode' binding.
+
 ** Grep
 
 +++
diff --git a/lisp/wdired.el b/lisp/wdired.el
index c7409446b19..78d0c7e0716 100644
--- a/lisp/wdired.el
+++ b/lisp/wdired.el
@@ -160,7 +160,7 @@ wdired-mode-map
   "C-c C-c" #'wdired-finish-edit
   "C-c C-k" #'wdired-abort-changes
   "C-c C-[" #'wdired-abort-changes
-  "C-x C-q" #'wdired-exit
+  "<remap> <read-only-mode>" #'wdired-exit
   "RET"     #'undefined
   "C-j"     #'undefined
   "C-o"     #'undefined
-- 
2.47.1