Subject: bug#75530: [PATCH v2 1/3] Remap read-only-mode in wdired-mode-map (bug#75530)

From: Liam Hupfer <[email-masked]>
Date: Sun, 2 Feb 2025 18:12:45 -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 259b6e03549..188aaaf6e5b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -892,6 +892,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 user 'read-only-mode' bindings.
+If you add or change bindings for 'read-only-mode', 'wdired-exit' will
+respect those bindings.  Previously, it used a fixed 'C-x C-q' binding
+regardless of 'read-only-mode' bindings.
+
 ** 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 @@ nonexistent directory will fail."
   "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