all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Liam Hupfer <liam@hpfr.net>
To: 75530@debbugs.gnu.org
Cc: Eli Zaretskii <eliz@gnu.org>, Liam Hupfer <liam@hpfr.net>
Subject: bug#75530: [PATCH v2.1 0/3] Consistently remap read-only-mode for special edit modes
Date: Mon,  3 Feb 2025 22:10:03 -0600	[thread overview]
Message-ID: <20250204041003.423902-1-liam@hpfr.net> (raw)
In-Reply-To: <cover.1736729460.git.liam@hpfr.net>

v2.1 is v2 but in a single email per Eli’s preference. Apparently
git-send-email(1) doesn’t expose a way to create a single email with
multiple patches as MIME attachments, but the --output and --no-thread
options are sufficient to generate one long message that applies cleanly
with ‘git am --empty=drop’.

Thanks!

Liam Hupfer (3):
  Remap read-only-mode in wdired-mode-map (bug#75530)
  Remap read-only-mode for Occur modes (bug#75530)
  Remap read-only-mode for Grep Edit (bug#75530)

 etc/NEWS               | 23 +++++++++++++++++++----
 lisp/progmodes/grep.el |  6 ++++--
 lisp/replace.el        |  2 ++
 lisp/wdired.el         |  2 +-
 4 files changed, 26 insertions(+), 7 deletions(-)


base-commit: c4a67a405072601b9d7dd95dc94c0b402e1e0ae6
-- 
2.47.1

From 551fcce44e2ea235cdae8da3d9afefe5e7a0a9b5 Mon Sep 17 00:00:00 2001
From: Liam Hupfer <liam@hpfr.net>
Date: Sun, 12 Jan 2025 12:24:38 -0600
Subject: [PATCH v2.1 1/3] Remap read-only-mode in wdired-mode-map (bug#75530)

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 8cf86d1375d..6893d71268a 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


From 5fe91fc4cb5deebc38d8fca3d4ebda935cfe9e58 Mon Sep 17 00:00:00 2001
From: Liam Hupfer <liam@hpfr.net>
Date: Sun, 12 Jan 2025 12:31:17 -0600
Subject: [PATCH v2.1 2/3] Remap read-only-mode for Occur modes (bug#75530)

occur-edit-mode behaves similarly to wdired-mode.  Dired remaps
read-only-mode to toggle wdired, so set up similar remaps for
occur-mode-map and occur-edit-mode-map.

* lisp/replace.el (occur-mode-map): Remap read-only-mode to
occur-edit-mode.
(occur-edit-mode-map): Remap read-only-mode to occur-cease-edit.
* etc/NEWS (Occur mode): Document Occur Edit entry/exit remaps.
---
 etc/NEWS        | 8 ++++++++
 lisp/replace.el | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index 6893d71268a..ce78759849c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1082,6 +1082,14 @@ destination window is chosen using 'display-buffer-alist'.  Example:
                                    display-buffer-use-some-window)
                                   (some-window . mru))))
 
+** Occur mode
+
+---
+*** New Occur Edit entry and exit based on 'read-only-mode' bindings.
+In addition to entering 'occur-edit-mode' with 'e' and exiting with 'C-c
+C-c', you can now use 'C-x C-q' (or anywhere you bind 'read-only-mode')
+for entry and exit.
+
 \f
 * New Modes and Packages in Emacs 31.1
 
diff --git a/lisp/replace.el b/lisp/replace.el
index 3bd803ce347..724e54f256b 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1304,6 +1304,7 @@ a previously found match."
     (define-key map [mouse-2] 'occur-mode-mouse-goto)
     (define-key map "\C-c\C-c" 'occur-mode-goto-occurrence)
     (define-key map "e" 'occur-edit-mode)
+    (define-key map [remap read-only-mode] 'occur-edit-mode)
     (define-key map "\C-m" 'occur-mode-goto-occurrence)
     (define-key map "o" 'occur-mode-goto-occurrence-other-window)
     (define-key map "\C-o" 'occur-mode-display-occurrence)
@@ -1366,6 +1367,7 @@ Alternatively, click \\[occur-mode-mouse-goto] on an item to go to it.
     (set-keymap-parent map text-mode-map)
     (define-key map [mouse-2] 'occur-mode-mouse-goto)
     (define-key map "\C-c\C-c" 'occur-cease-edit)
+    (define-key map [remap read-only-mode] 'occur-cease-edit)
     (define-key map "\C-o" 'occur-mode-display-occurrence)
     (define-key map "\C-c\C-f" 'next-error-follow-minor-mode)
     (define-key map [menu-bar occur] (cons "Occur" occur-menu-map))
-- 
2.47.1


From b1b4dc4816acb7a8727129c74fd1c9ce3538fa89 Mon Sep 17 00:00:00 2001
From: Liam Hupfer <liam@hpfr.net>
Date: Sun, 12 Jan 2025 17:16:13 -0600
Subject: [PATCH v2.1 3/3] Remap read-only-mode for Grep Edit (bug#75530)

Like Dired and Occur, Grep buffers now remap read-only-mode to a useful
editing mode.

* lisp/progmodes/grep.el (grep-mode-map): Remap read-only-mode to
grep-change-to-grep-edit-mode.
(grep-edit-mode-map): Remap read-only-mode to grep-edit-save-changes.
* etc/NEWS (Grep): Document remaps.
---
 etc/NEWS               | 9 +++++----
 lisp/progmodes/grep.el | 6 ++++--
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index ce78759849c..45fff54f433 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -902,10 +902,11 @@ regardless of 'read-only-mode' bindings.
 
 +++
 *** Grep results can be edited to reflect changes in the originating file.
-Like Occur Edit mode, typing 'e' in the "*grep*" buffer will now make
-the 'grep' results editable.  The edits will be reflected in the buffer
-visiting the originating file.  Typing 'C-c C-c' will leave the Grep
-Edit mode.
+Like Occur Edit mode, typing 'e' or 'C-x C-q' (or your own
+'read-only-mode' binding) in the "*grep*" buffer will now make the
+'grep' results editable.  The edits will be reflected in the buffer
+visiting the originating file.  Typing 'C-c C-c' or 'C-x C-q' (or your
+own 'read-only-mode' binding) will leave the Grep Edit mode.
 
 ** time-stamp
 
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index d04e9945b0d..b29f56c9ed4 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -312,7 +312,8 @@ This keymap inherits from `compilation-minor-mode-map'."
   "TAB"       #'compilation-next-error
   "<backtab>" #'compilation-previous-error
 
-  "e"         #'grep-change-to-grep-edit-mode)
+  "e"         #'grep-change-to-grep-edit-mode
+  "<remap> <read-only-mode>" #'grep-change-to-grep-edit-mode)
 
 (easy-menu-define grep-menu-map grep-mode-map
   "Menu for grep buffers."
@@ -1083,7 +1084,8 @@ list is empty)."
 (defvar-keymap grep-edit-mode-map
   :doc "Keymap for `grep-edit-mode'."
   :parent text-mode-map
-  "C-c C-c" #'grep-edit-save-changes)
+  "C-c C-c" #'grep-edit-save-changes
+  "<remap> <read-only-mode>" #'grep-edit-save-changes)
 
 (defvar grep-edit-mode-hook nil
   "Hooks run when changing to Grep-Edit mode.")
-- 
2.47.1






  parent reply	other threads:[~2025-02-04  4:10 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13  0:56 bug#75530: [PATCH 0/3] Consistently remap read-only-mode for special edit modes Liam Hupfer
2025-01-13  1:00 ` bug#75530: [PATCH 1/3] Remap read-only-mode in wdired-mode-map Liam Hupfer
2025-01-18 10:23   ` Eli Zaretskii
2025-02-02 19:22     ` Liam Hupfer
2025-02-02 19:38       ` Eli Zaretskii
2025-01-13  1:00 ` bug#75530: [PATCH 2/3] Remap read-only-mode for Occur modes Liam Hupfer
2025-01-18 10:26   ` Eli Zaretskii
2025-01-13  1:00 ` bug#75530: [PATCH 3/3] Remap read-only-mode for Grep Edit Liam Hupfer
2025-01-18 10:27   ` Eli Zaretskii
2025-02-02 19:30     ` Liam Hupfer
2025-02-02 19:42       ` Eli Zaretskii
2025-02-02 20:27         ` Liam Hupfer
2025-02-03 11:47           ` Eli Zaretskii
2025-02-04  3:52             ` Liam Hupfer
2025-01-15  7:29 ` bug#75530: liam@hpfr.net me--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-02-03  0:12 ` bug#75530: [PATCH v2 0/3] Consistently remap read-only-mode for special edit modes Liam Hupfer
2025-02-03  0:12   ` bug#75530: [PATCH v2 1/3] Remap read-only-mode in wdired-mode-map (bug#75530) Liam Hupfer
2025-02-03  0:12   ` bug#75530: [PATCH v2 2/3] Remap read-only-mode for Occur modes (bug#75530) Liam Hupfer
2025-02-03  4:38     ` Howard Melman
2025-02-04  4:52       ` Liam Hupfer
2025-02-04  7:44         ` Juri Linkov
2025-02-04 16:12           ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-02-05  5:27           ` Liam Hupfer
2025-02-05  6:01             ` Alfred M. Szmidt
2025-02-05  7:33             ` Juri Linkov
2025-02-05 12:56               ` Howard Melman
2025-02-06  1:19                 ` Liam Hupfer
2025-02-06 17:13                   ` Juri Linkov
2025-02-07  3:17                     ` Liam Hupfer
2025-02-03  0:12   ` bug#75530: [PATCH v2 3/3] Remap read-only-mode for Grep Edit (bug#75530) Liam Hupfer
2025-02-04  4:10 ` Liam Hupfer [this message]
2025-02-05 12:56 ` bug#75530: [PATCH v2 2/3] Remap read-only-mode for Occur modes (bug#75530) Howard Melman
2025-02-06  0:58   ` Liam Hupfer
2025-02-07  3:31 ` bug#75530: [PATCH v3 0/2] Tweak Wdired-related bindings Liam Hupfer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250204041003.423902-1-liam@hpfr.net \
    --to=liam@hpfr.net \
    --cc=75530@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.