* bug#75530: [PATCH 0/3] Consistently remap read-only-mode for special edit modes
@ 2025-01-13 0:56 Liam Hupfer
2025-01-13 1:00 ` bug#75530: [PATCH 1/3] Remap read-only-mode in wdired-mode-map Liam Hupfer
` (6 more replies)
0 siblings, 7 replies; 31+ messages in thread
From: Liam Hupfer @ 2025-01-13 0:56 UTC (permalink / raw)
To: 75530; +Cc: Liam Hupfer
Hi,
These patches remap read-only-mode consistently for Dired/Wdired,
Occur/Occur Edit, and Grep/Grep Edit. While Dired already has this
remap defined, Wdired binds to C-x C-q, meaning users who change their
read-only-mode binding get an inconsistent experience. I went ahead and
applied the same remap to Occur and Grep, since it seems intuitive for
these modes to behave similarly.
There are other entry/exit points documented in the relevant manual
sections, so I did not change them for now, but let me know what you
think. The dedicated bindings for Occur and Grep (e and C-c C-c) are
shorter or simpler than the typical read-only-mode binding but aren’t
global, so they have to be learned.
I stuck with a simple NEWS entry for now. No entry for Grep Edit since
it’s new anyway.
Thanks!
Liam Hupfer (3):
Remap read-only-mode in wdired-mode-map
Remap read-only-mode for Occur modes
Remap read-only-mode for Grep Edit
etc/NEWS | 13 +++++++++++++
lisp/progmodes/grep.el | 6 ++++--
lisp/replace.el | 2 ++
lisp/wdired.el | 2 +-
4 files changed, 20 insertions(+), 3 deletions(-)
base-commit: 7648faedd3aeabadc66c67630809ef6178f4851a
--
2.47.1
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH 1/3] Remap read-only-mode in wdired-mode-map
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 ` Liam Hupfer
2025-01-18 10:23 ` Eli Zaretskii
2025-01-13 1:00 ` bug#75530: [PATCH 2/3] Remap read-only-mode for Occur modes Liam Hupfer
` (5 subsequent siblings)
6 siblings, 1 reply; 31+ messages in thread
From: Liam Hupfer @ 2025-01-13 1:00 UTC (permalink / raw)
To: 75530; +Cc: Liam Hupfer
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
^ permalink raw reply related [flat|nested] 31+ messages in thread
* bug#75530: [PATCH 2/3] Remap read-only-mode for Occur modes
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-13 1:00 ` 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
` (4 subsequent siblings)
6 siblings, 1 reply; 31+ messages in thread
From: Liam Hupfer @ 2025-01-13 1:00 UTC (permalink / raw)
To: 75530; +Cc: Liam Hupfer
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 | 7 +++++++
lisp/replace.el | 2 ++
2 files changed, 9 insertions(+)
diff --git a/etc/NEWS b/etc/NEWS
index 220730c2cc0..ec9d8b058e1 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -946,6 +946,13 @@ destination window is chosen using 'display-buffer-alist'. Example:
display-buffer-use-some-window)
(some-window . mru))))
+** Occur mode
+
+---
+*** Occur Edit entry and exit points remap 'read-only-mode'.
+Like Wdired, 'read-only-mode' is remapped in 'occur-mode-map' and
+'occur-edit-mode-map' to enter and exit 'occur-edit-mode', respectively.
+
\f
* New Modes and Packages in Emacs 31.1
diff --git a/lisp/replace.el b/lisp/replace.el
index cde3686dd12..4db069a1193 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1304,6 +1304,7 @@ occur-mode-map
(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 @@ occur-edit-mode-map
(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)
(bindings--define-key map [menu-bar occur] (cons "Occur" occur-menu-map))
--
2.47.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* bug#75530: [PATCH 3/3] Remap read-only-mode for Grep Edit
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-13 1:00 ` bug#75530: [PATCH 2/3] Remap read-only-mode for Occur modes Liam Hupfer
@ 2025-01-13 1:00 ` Liam Hupfer
2025-01-18 10:27 ` Eli Zaretskii
2025-01-15 7:29 ` bug#75530: liam@hpfr.net me--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
` (3 subsequent siblings)
6 siblings, 1 reply; 31+ messages in thread
From: Liam Hupfer @ 2025-01-13 1:00 UTC (permalink / raw)
To: 75530; +Cc: Liam Hupfer
Like Dired and Occur, writable Grep buffers can 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.
---
lisp/progmodes/grep.el | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 72c0f871e0b..c1d626016b0 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -312,7 +312,8 @@ grep-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 @@ grep-edit--prepare-buffer
(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
^ permalink raw reply related [flat|nested] 31+ messages in thread
* bug#75530: liam@hpfr.net
2025-01-13 0:56 bug#75530: [PATCH 0/3] Consistently remap read-only-mode for special edit modes Liam Hupfer
` (2 preceding siblings ...)
2025-01-13 1:00 ` bug#75530: [PATCH 3/3] Remap read-only-mode for Grep Edit Liam Hupfer
@ 2025-01-15 7:29 ` 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
` (2 subsequent siblings)
6 siblings, 0 replies; 31+ messages in thread
From: me--- via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2025-01-15 7:29 UTC (permalink / raw)
To: 75530
This looks great! Would be really sweet to get this one merged.
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH 1/3] Remap read-only-mode in wdired-mode-map
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
0 siblings, 1 reply; 31+ messages in thread
From: Eli Zaretskii @ 2025-01-18 10:23 UTC (permalink / raw)
To: Liam Hupfer; +Cc: 75530
> Cc: Liam Hupfer <liam@hpfr.net>
> From: Liam Hupfer <liam@hpfr.net>
> 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.
Thanks.
> * 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.
Please leave two spaces between sentences, per our conventions.
Also, this entry should mention the key bindings explicitly, since
that is what is being remapped. And the last sentence is not needed,
since NEWS doesn't normally need to justify the changes, only to
describe them.
P.S. When you submit modified patches, please mention the bug number
in the commit log message.
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH 2/3] Remap read-only-mode for Occur modes
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
0 siblings, 0 replies; 31+ messages in thread
From: Eli Zaretskii @ 2025-01-18 10:26 UTC (permalink / raw)
To: Liam Hupfer; +Cc: 75530
> Cc: Liam Hupfer <liam@hpfr.net>
> From: Liam Hupfer <liam@hpfr.net>
> Date: Sun, 12 Jan 2025 19:00:35 -0600
>
> +** Occur mode
> +
> +---
> +*** Occur Edit entry and exit points remap 'read-only-mode'.
> +Like Wdired, 'read-only-mode' is remapped in 'occur-mode-map' and
> +'occur-edit-mode-map' to enter and exit 'occur-edit-mode', respectively.
Please make this description stand-alone, without referring to Wdired.
People frequently read only the parts of NEWS that are of interest to
them.
And the same comments as for the previous patch: the NEWS entry should
explain the change in terms of key bindings, not in technical terms of
remapping, since this is a user-level change.
Thanks.
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH 3/3] Remap read-only-mode for Grep Edit
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
0 siblings, 1 reply; 31+ messages in thread
From: Eli Zaretskii @ 2025-01-18 10:27 UTC (permalink / raw)
To: Liam Hupfer; +Cc: 75530
> Cc: Liam Hupfer <liam@hpfr.net>
> From: Liam Hupfer <liam@hpfr.net>
> Date: Sun, 12 Jan 2025 19:00:36 -0600
>
> Like Dired and Occur, writable Grep buffers can now remap read-only-mode
> to a useful editing mode.
Thanks, but why there's no NEWS entry here?
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH 1/3] Remap read-only-mode in wdired-mode-map
2025-01-18 10:23 ` Eli Zaretskii
@ 2025-02-02 19:22 ` Liam Hupfer
2025-02-02 19:38 ` Eli Zaretskii
0 siblings, 1 reply; 31+ messages in thread
From: Liam Hupfer @ 2025-02-02 19:22 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 75530
[-- Attachment #1: Type: text/plain, Size: 1211 bytes --]
Thanks for the review Eli!
Eli Zaretskii <eliz@gnu.org> writes:
>> 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.
>
> Also, this entry should mention the key bindings explicitly, since
> that is what is being remapped. And the last sentence is not needed,
> since NEWS doesn’t normally need to justify the changes, only to
> describe them.
Can you give an example of what you expect here? Since the default
‘read-only-mode’ binding is also C-x C-q, the only user-facing aspect of
this change is the remap itself. Users who don’t change their
‘read-only-mode’ binding will not notice any difference.
—Liam
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH 3/3] Remap read-only-mode for Grep Edit
2025-01-18 10:27 ` Eli Zaretskii
@ 2025-02-02 19:30 ` Liam Hupfer
2025-02-02 19:42 ` Eli Zaretskii
0 siblings, 1 reply; 31+ messages in thread
From: Liam Hupfer @ 2025-02-02 19:30 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 75530
[-- Attachment #1: Type: text/plain, Size: 921 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> Cc: Liam Hupfer <liam@hpfr.net>
>> From: Liam Hupfer <liam@hpfr.net>
>> Date: Sun, 12 Jan 2025 19:00:36 -0600
>>
>> Like Dired and Occur, writable Grep buffers can now remap read-only-mode
>> to a useful editing mode.
>
> Thanks, but why there’s no NEWS entry here?
From the cover letter:
> No entry for Grep Edit since it’s new anyway.
I assume the NEWS files are release notes written for users when they
upgrade to a new release. From the perspective of a user switching from
a past release to 31 (after it releases, of course), this tiny binding
change is not noteworthy, since the entire Grep Edit mode is new anyway
and already has a dedicated entry. And anyone living on master can be
expected to understand its volatility and to understand how to browse
commits, no? Otherwise, how is NEWS different from ‘git log’?
Thanks!
—Liam
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH 1/3] Remap read-only-mode in wdired-mode-map
2025-02-02 19:22 ` Liam Hupfer
@ 2025-02-02 19:38 ` Eli Zaretskii
0 siblings, 0 replies; 31+ messages in thread
From: Eli Zaretskii @ 2025-02-02 19:38 UTC (permalink / raw)
To: Liam Hupfer; +Cc: 75530
> From: Liam Hupfer <liam@hpfr.net>
> Cc: 75530@debbugs.gnu.org
> Date: Sun, 02 Feb 2025 13:22:17 -0600
>
> >> +—
> >> +*** 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.
> >
> > Also, this entry should mention the key bindings explicitly, since
> > that is what is being remapped. And the last sentence is not needed,
> > since NEWS doesn’t normally need to justify the changes, only to
> > describe them.
>
> Can you give an example of what you expect here? Since the default
> ‘read-only-mode’ binding is also C-x C-q, the only user-facing aspect of
> this change is the remap itself. Users who don’t change their
> ‘read-only-mode’ binding will not notice any difference.
Instead of talking about remapping read-only-mode, I'd like NEWS to
explain what that means from the user POV. I presume you wanted to
allow users bind read-only-mode to something other than "C-x C-q", and
have wdired-exit binding to follow suit. This is what the NEWS entry
should say. Talking about remapping describes the implementation, not
the user-facing changes in behavior.
Thanks.
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH 3/3] Remap read-only-mode for Grep Edit
2025-02-02 19:30 ` Liam Hupfer
@ 2025-02-02 19:42 ` Eli Zaretskii
2025-02-02 20:27 ` Liam Hupfer
0 siblings, 1 reply; 31+ messages in thread
From: Eli Zaretskii @ 2025-02-02 19:42 UTC (permalink / raw)
To: Liam Hupfer; +Cc: 75530
> From: Liam Hupfer <liam@hpfr.net>
> Cc: 75530@debbugs.gnu.org
> Date: Sun, 02 Feb 2025 13:30:04 -0600
>
> > Thanks, but why there’s no NEWS entry here?
>
> >From the cover letter:
>
> > No entry for Grep Edit since it’s new anyway.
But adding to the Grep entry something about this is not out of the
question, is it?
> I assume the NEWS files are release notes written for users when they
> upgrade to a new release. From the perspective of a user switching from
> a past release to 31 (after it releases, of course), this tiny binding
> change is not noteworthy, since the entire Grep Edit mode is new anyway
> and already has a dedicated entry. And anyone living on master can be
> expected to understand its volatility and to understand how to browse
> commits, no? Otherwise, how is NEWS different from ‘git log’?
Then why does the Grep entry mention "C-c C-c"? Isn't "C-x C-q" no
less important?
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH 3/3] Remap read-only-mode for Grep Edit
2025-02-02 19:42 ` Eli Zaretskii
@ 2025-02-02 20:27 ` Liam Hupfer
2025-02-03 11:47 ` Eli Zaretskii
0 siblings, 1 reply; 31+ messages in thread
From: Liam Hupfer @ 2025-02-02 20:27 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 75530
[-- Attachment #1: Type: text/plain, Size: 452 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
> Then why does the Grep entry mention “C-c C-c”? Isn’t “C-x C-q” no
> less important?
Good point. I’ll address this and the rest of your feedback (hopefully) in a new revision.
Aside: do you always prefer patch series as attachments to a single
message rather than threaded messages, or just recommend it to stave off
malformed patches from users who don’t use git-send-email?
—Liam
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH v2 0/3] Consistently remap read-only-mode for special edit modes
2025-01-13 0:56 bug#75530: [PATCH 0/3] Consistently remap read-only-mode for special edit modes Liam Hupfer
` (3 preceding siblings ...)
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 ` 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
` (2 more replies)
2025-02-04 4:10 ` bug#75530: [PATCH v2.1 0/3] Consistently remap read-only-mode for special edit modes Liam Hupfer
2025-02-05 12:56 ` bug#75530: [PATCH v2 2/3] Remap read-only-mode for Occur modes (bug#75530) Howard Melman
6 siblings, 3 replies; 31+ messages in thread
From: Liam Hupfer @ 2025-02-03 0:12 UTC (permalink / raw)
To: 75530, Eli Zaretskii; +Cc: Liam Hupfer
v2 hopefully addresses Eli’s feedback on v1. 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: 669bb2eaf535728c58899ab56f0f7d5bdd3747c0
--
2.47.1
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH v2 1/3] Remap read-only-mode in wdired-mode-map (bug#75530)
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 ` 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 0:12 ` bug#75530: [PATCH v2 3/3] Remap read-only-mode for Grep Edit (bug#75530) Liam Hupfer
2 siblings, 0 replies; 31+ messages in thread
From: Liam Hupfer @ 2025-02-03 0:12 UTC (permalink / raw)
To: 75530, Eli Zaretskii; +Cc: Liam Hupfer
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
^ permalink raw reply related [flat|nested] 31+ messages in thread
* bug#75530: [PATCH v2 2/3] Remap read-only-mode for Occur modes (bug#75530)
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 ` Liam Hupfer
2025-02-03 4:38 ` Howard Melman
2025-02-03 0:12 ` bug#75530: [PATCH v2 3/3] Remap read-only-mode for Grep Edit (bug#75530) Liam Hupfer
2 siblings, 1 reply; 31+ messages in thread
From: Liam Hupfer @ 2025-02-03 0:12 UTC (permalink / raw)
To: 75530, Eli Zaretskii; +Cc: Liam Hupfer
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 188aaaf6e5b..f25e8b2fe87 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1058,6 +1058,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
^ permalink raw reply related [flat|nested] 31+ messages in thread
* bug#75530: [PATCH v2 3/3] Remap read-only-mode for Grep Edit (bug#75530)
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 0:12 ` Liam Hupfer
2 siblings, 0 replies; 31+ messages in thread
From: Liam Hupfer @ 2025-02-03 0:12 UTC (permalink / raw)
To: 75530, Eli Zaretskii; +Cc: Liam Hupfer
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 f25e8b2fe87..2e3c60799de 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.
** TeX modes
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
^ permalink raw reply related [flat|nested] 31+ messages in thread
* bug#75530: [PATCH v2 2/3] Remap read-only-mode for Occur modes (bug#75530)
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
0 siblings, 1 reply; 31+ messages in thread
From: Howard Melman @ 2025-02-03 4:38 UTC (permalink / raw)
To: 75530
Liam Hupfer <liam@hpfr.net> writes:
> 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.
I am all for consistency in these three mode, see Emacs
bug#16214. But in that discussion people brought up that
unlike for dired, for occur and grep, people sometimes use
those commands to (1) search for and collect text, and then
edit into something (say a list or paragraph) rather than
wanting to (2) edit changes into the original sources (which
they also want to do some other times). So the proposal was
to leave C-x C-q to change read-only to cover the first case
and to use "e" to enter the "writable" modes in all three
cases and for the second case. C-x C-q in dired was fine to
leave to enter wdired since (1) it already does that and (2)
people don't edit the output there much.
I'm all for using remap instead of hard coding a binding to
C-x C-q, but I wanted to make sure these changes considered
those use cases.
--
Howard
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH 3/3] Remap read-only-mode for Grep Edit
2025-02-02 20:27 ` Liam Hupfer
@ 2025-02-03 11:47 ` Eli Zaretskii
2025-02-04 3:52 ` Liam Hupfer
0 siblings, 1 reply; 31+ messages in thread
From: Eli Zaretskii @ 2025-02-03 11:47 UTC (permalink / raw)
To: Liam Hupfer; +Cc: 75530
> From: Liam Hupfer <liam@hpfr.net>
> Cc: 75530@debbugs.gnu.org
> Date: Sun, 02 Feb 2025 14:27:03 -0600
>
> Aside: do you always prefer patch series as attachments to a single
> message rather than threaded messages, or just recommend it to stave off
> malformed patches from users who don’t use git-send-email?
A single message is preferred, as that makes it easier for me to find
related messages (the Subject stays the same). But since you've
already sent the patches as separate messages without waiting for me
to reply, this sounds a moot point...
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH 3/3] Remap read-only-mode for Grep Edit
2025-02-03 11:47 ` Eli Zaretskii
@ 2025-02-04 3:52 ` Liam Hupfer
0 siblings, 0 replies; 31+ messages in thread
From: Liam Hupfer @ 2025-02-04 3:52 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 75530
[-- Attachment #1: Type: text/plain, Size: 818 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Liam Hupfer <liam@hpfr.net>
>> Cc: 75530@debbugs.gnu.org
>> Date: Sun, 02 Feb 2025 14:27:03 -0600
>>
>> Aside: do you always prefer patch series as attachments to a single
>> message rather than threaded messages, or just recommend it to stave off
>> malformed patches from users who don’t use git-send-email?
>
> A single message is preferred, as that makes it easier for me to find
> related messages (the Subject stays the same). But since you’ve
> already sent the patches as separate messages without waiting for me
> to reply, this sounds a moot point…
I just wanted to get it out there in its current state in case you had
more feedback while I was away. I’ll resend as a single message and keep
that in mind going forward!
—Liam
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH v2.1 0/3] Consistently remap read-only-mode for special edit modes
2025-01-13 0:56 bug#75530: [PATCH 0/3] Consistently remap read-only-mode for special edit modes Liam Hupfer
` (4 preceding siblings ...)
2025-02-03 0:12 ` bug#75530: [PATCH v2 0/3] Consistently remap read-only-mode for special edit modes Liam Hupfer
@ 2025-02-04 4:10 ` Liam Hupfer
2025-02-05 12:56 ` bug#75530: [PATCH v2 2/3] Remap read-only-mode for Occur modes (bug#75530) Howard Melman
6 siblings, 0 replies; 31+ messages in thread
From: Liam Hupfer @ 2025-02-04 4:10 UTC (permalink / raw)
To: 75530; +Cc: Eli Zaretskii, Liam Hupfer
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
^ permalink raw reply related [flat|nested] 31+ messages in thread
* bug#75530: [PATCH v2 2/3] Remap read-only-mode for Occur modes (bug#75530)
2025-02-03 4:38 ` Howard Melman
@ 2025-02-04 4:52 ` Liam Hupfer
2025-02-04 7:44 ` Juri Linkov
0 siblings, 1 reply; 31+ messages in thread
From: Liam Hupfer @ 2025-02-04 4:52 UTC (permalink / raw)
To: Howard Melman, 75530
[-- Attachment #1: Type: text/plain, Size: 2208 bytes --]
Hi Howard,
Don’t forget to reply all! Not everyone subscribes to bug-gnu-emacs. I
just happened to check this thread on <https://yhetil.org>. Fortunately
[piem-inject-thread-into-maildir] makes it easy to correct this. Might
have to make that a habit on my end.
Howard Melman <hmelman@gmail.com> writes:
> I am all for consistency in these three mode, see Emacs bug#16214. But
> in that discussion people brought up that unlike for dired, for occur
> and grep, people sometimes use those commands to (1) search for and
> collect text, and then edit into something (say a list or paragraph)
> rather than wanting to (2) edit changes into the original sources
> (which they also want to do some other times). So the proposal was to
> leave C-x C-q to change read-only to cover the first case and to use
> “e” to enter the “writable” modes in all three cases and for the
> second case. C-x C-q in dired was fine to leave to enter wdired since
> (1) it already does that and (2) people don’t edit the output there
> much.
Looks like you’re referring to [Juri’s reply]:
> The difference is because it’s more useful to type `C-x C-q’ to change
> read-onlyness of an occur buffer and edit it textually than to do the
> same in a dired buffer where random edits (other than renaming file
> names) make less sense.
This is a little confusing to me. ‘read-only-mode’ on its own will make
the buffer editable, but won’t it leave Occur or Grep’s special bindings
in place? So you can’t even insert text! Seems to me that
‘fundamental-mode’ followed by ‘read-only-mode’ (which would then be
available on ‘C-x C-q’) would be needed? Or ‘switch-to-buffer’ plus
‘insert-buffer’? Not to mention Occur uses text properties to make the
line numbers read-only even when the buffer is writable. Maybe that
wasn’t the case in 2013.
I don’t mean to prescribe people their [workflows], of course. Maybe I’m
missing something?
Thanks!
[piem-inject-thread-into-maildir] <https://docs.kyleam.com/piem.html>
[Juri’s reply] <https://yhetil.org/emacs/87sitl51un.fsf@mail.jurta.org/>
[workflows] <https://xkcd.com/1172/>
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH v2 2/3] Remap read-only-mode for Occur modes (bug#75530)
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
0 siblings, 2 replies; 31+ messages in thread
From: Juri Linkov @ 2025-02-04 7:44 UTC (permalink / raw)
To: Liam Hupfer; +Cc: 75530, Howard Melman
>> The difference is because it’s more useful to type `C-x C-q’ to change
>> read-onlyness of an occur buffer and edit it textually than to do the
>> same in a dired buffer where random edits (other than renaming file
>> names) make less sense.
>
> This is a little confusing to me. ‘read-only-mode’ on its own will make
> the buffer editable, but won’t it leave Occur or Grep’s special bindings
> in place? So you can’t even insert text! Seems to me that
> ‘fundamental-mode’ followed by ‘read-only-mode’ (which would then be
> available on ‘C-x C-q’) would be needed? Or ‘switch-to-buffer’ plus
> ‘insert-buffer’?
One particular use case where it's useful to disable the read-only
status with 'C-x C-q' is to use e.g. 'M-x flush-lines' to further
narrow down the results displayed in the Occur buffer.
> Not to mention Occur uses text properties to make the
> line numbers read-only even when the buffer is writable. Maybe that
> wasn’t the case in 2013.
Indeed, unfortunately this use case was precluded after the change
that added the read-only property on line numbers was made recently
on 2022-01-23 in the commit 1bcbca3750d9e8c47bee7ac893b885ade584d783.
Maybe we need to revert this change and find another solution.
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH v2 2/3] Remap read-only-mode for Occur modes (bug#75530)
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
1 sibling, 0 replies; 31+ messages in thread
From: Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2025-02-04 16:12 UTC (permalink / raw)
To: Juri Linkov, Liam Hupfer; +Cc: 75530@debbugs.gnu.org, Howard Melman
> One particular use case where it's useful to disable the read-only
> status with 'C-x C-q' is to use e.g. 'M-x flush-lines' to further
> narrow down the results displayed in the Occur buffer.
Absolutely.
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH v2 2/3] Remap read-only-mode for Occur modes (bug#75530)
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
1 sibling, 2 replies; 31+ messages in thread
From: Liam Hupfer @ 2025-02-05 5:27 UTC (permalink / raw)
To: Juri Linkov; +Cc: 75530, Howard Melman
[-- Attachment #1: Type: text/plain, Size: 1555 bytes --]
Juri Linkov <juri@linkov.net> writes:
> One particular use case where it’s useful to disable the read-only
> status with ’C-x C-q’ is to use e.g. ’M-x flush-lines’ to further
> narrow down the results displayed in the Occur buffer.
>
>> Not to mention Occur uses text properties to make the
>> line numbers read-only even when the buffer is writable. Maybe that
>> wasn’t the case in 2013.
>
> Indeed, unfortunately this use case was precluded after the change
> that added the read-only property on line numbers was made recently
> on 2022-01-23 in the commit 1bcbca3750d9e8c47bee7ac893b885ade584d783.
Thanks for confirming!
> Maybe we need to revert this change and find another solution.
Seeing as nobody seemed to notice or care that this use case was broken
for three years and two major releases, I’m personally inclined to
proceed further in the direction Lars set previously by considering
Occur and Grep as proper special modes, with special C-x C-q behavior,
like Dired. I don’t find the rationale particularly compelling that
Occur and Grep buffer contents are more commonly edited as raw text than
Dired. Not enough to justify the discrepancy, anyway. With
special-mode’s bindings in mind, I think it makes more sense to change
modes before editing the contents.
I might have to retract that comment about prescribing workflows. This
series is tweaking defaults, so I guess that’s its whole purpose! Maybe
others can chime in on their tastes here as well?
Thanks for your input!
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH v2 2/3] Remap read-only-mode for Occur modes (bug#75530)
2025-02-05 5:27 ` Liam Hupfer
@ 2025-02-05 6:01 ` Alfred M. Szmidt
2025-02-05 7:33 ` Juri Linkov
1 sibling, 0 replies; 31+ messages in thread
From: Alfred M. Szmidt @ 2025-02-05 6:01 UTC (permalink / raw)
To: Liam Hupfer; +Cc: 75530, hmelman, juri
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1743 bytes --]
> Indeed, unfortunately this use case was precluded after the change
> that added the read-only property on line numbers was made recently
> on 2022-01-23 in the commit 1bcbca3750d9e8c47bee7ac893b885ade584d783.
Thanks for confirming!
> Maybe we need to revert this change and find another solution.
That would be amazing!
Seeing as nobody seemed to notice or care that this use case was broken
for three years and two major releases, I’m personally inclined to
proceed further in the direction Lars set previously by considering
Occur and Grep as proper special modes, with special C-x C-q behavior,
like Dired. I don’t find the rationale particularly compelling that
Occur and Grep buffer contents are more commonly edited as raw text than
Dired. Not enough to justify the discrepancy, anyway. With
special-mode’s bindings in mind, I think it makes more sense to change
modes before editing the contents.
Not everyone reads the bug lists, and asking for such feedback is
better done elsewhere. That nobody commented for a few years does not
mean nobody cared it was broken, such blaming is unkind to all who use
Emacs. Many people also use older Emacsen, and might not even notice.
Changing modes for occur/grep means you loose out on being able to
jump to the place where there is a match, being able to flush-lines,
or other maniupulation is useful and important.
I reported about this issue several years ago, but come to live with
it like with many other things.
I might have to retract that comment about prescribing workflows. This
series is tweaking defaults, so I guess that’s its whole purpose! Maybe
others can chime in on their tastes here as well?
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH v2 2/3] Remap read-only-mode for Occur modes (bug#75530)
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
1 sibling, 1 reply; 31+ messages in thread
From: Juri Linkov @ 2025-02-05 7:33 UTC (permalink / raw)
To: Liam Hupfer; +Cc: 75530, Howard Melman
>> Maybe we need to revert this change and find another solution.
>
> Seeing as nobody seemed to notice or care that this use case was broken
> for three years and two major releases
I think many people noticed this regression as I did, but the problem is that
it takes too much time to analyze bug#53419 and find another solution,
but there were many other more urgent things to do.
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH v2 2/3] Remap read-only-mode for Occur modes (bug#75530)
2025-02-05 7:33 ` Juri Linkov
@ 2025-02-05 12:56 ` Howard Melman
2025-02-06 1:19 ` Liam Hupfer
0 siblings, 1 reply; 31+ messages in thread
From: Howard Melman @ 2025-02-05 12:56 UTC (permalink / raw)
To: 75530
Juri Linkov <juri@linkov.net> writes:
>>> Maybe we need to revert this change and find another solution.
>>
>> Seeing as nobody seemed to notice or care that this use case was broken
>> for three years and two major releases
>
> I think many people noticed this regression as I did, but the problem is that
> it takes too much time to analyze bug#53419 and find another solution,
> but there were many other more urgent things to do.
As I said in Emacs bug#16214 my preferred solution is to
leave C-x C-q as is in all three modes and to standardize on
e to enter the editable mode and C-c C-c to leave it.
C-c C-c already does this in all three modes and e does this
in occur and when I last looked was unbound in grep. The
problem the last time was dired has e bound to
dired-find-file but that command is already bound to f to
and RET, so IMHO changing it for e is not a big deal (and of
course I do that in my personal config). The argument last
time was that changing a binding was too much, but I think
that's weakened now as this patch did it.
And I think the muscle memory problem is improved because e
would work in all three modes as opposed to different modes
have different ways to enter the editable versions (that's
been my experience).
[I read this list in gnus via gmame, I've always just used F
to Followup. For this message I've manually put To and Cc
headers in. Is there a better way?]
--
Howard
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH v2 2/3] Remap read-only-mode for Occur modes (bug#75530)
2025-01-13 0:56 bug#75530: [PATCH 0/3] Consistently remap read-only-mode for special edit modes Liam Hupfer
` (5 preceding siblings ...)
2025-02-04 4:10 ` bug#75530: [PATCH v2.1 0/3] Consistently remap read-only-mode for special edit modes Liam Hupfer
@ 2025-02-05 12:56 ` Howard Melman
2025-02-06 0:58 ` Liam Hupfer
6 siblings, 1 reply; 31+ messages in thread
From: Howard Melman @ 2025-02-05 12:56 UTC (permalink / raw)
To: liam, juri; +Cc: 75530
The following message is a courtesy copy of an article
that has been posted to gmane.emacs.bugs as well.
Juri Linkov <juri@linkov.net> writes:
>>> Maybe we need to revert this change and find another solution.
>>
>> Seeing as nobody seemed to notice or care that this use case was broken
>> for three years and two major releases
>
> I think many people noticed this regression as I did, but the problem is that
> it takes too much time to analyze bug#53419 and find another solution,
> but there were many other more urgent things to do.
As I said in Emacs bug#16214 my preferred solution is to
leave C-x C-q as is in all three modes and to standardize on
e to enter the editable mode and C-c C-c to leave it.
C-c C-c already does this in all three modes and e does this
in occur and when I last looked was unbound in grep. The
problem the last time was dired has e bound to
dired-find-file but that command is already bound to f to
and RET, so IMHO changing it for e is not a big deal (and of
course I do that in my personal config). The argument last
time was that changing a binding was too much, but I think
that's weakened now as this patch did it.
And I think the muscle memory problem is improved because e
would work in all three modes as opposed to different modes
have different ways to enter the editable versions (that's
been my experience).
[I read this list in gnus via gmame, I've always just used F
to Followup. For this message I've manually put To and Cc
headers in. Is there a better way?]
--
Howard
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH v2 2/3] Remap read-only-mode for Occur modes (bug#75530)
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
0 siblings, 0 replies; 31+ messages in thread
From: Liam Hupfer @ 2025-02-06 0:58 UTC (permalink / raw)
To: Howard Melman, juri; +Cc: 75530
Howard Melman <hmelman@gmail.com> writes:
> The following message is a courtesy copy of an article
> that has been posted to gmane.emacs.bugs as well.
> [I read this list in gnus via gmame, I've always just used F
> to Followup. For this message I've manually put To and Cc
> headers in. Is there a better way?]
Looks like you’re missing the In-Reply-To, which is probably worse for
unsubscribed email-only participants than not getting the mail at all.
So never mind my previous request, I guess. I haven’t used a newsgroup
interface to a mailing list before so I’m not sure if the Gnus
wide-reply commands work there. Worth a shot?
^ permalink raw reply [flat|nested] 31+ messages in thread
* bug#75530: [PATCH v2 2/3] Remap read-only-mode for Occur modes (bug#75530)
2025-02-05 12:56 ` Howard Melman
@ 2025-02-06 1:19 ` Liam Hupfer
0 siblings, 0 replies; 31+ messages in thread
From: Liam Hupfer @ 2025-02-06 1:19 UTC (permalink / raw)
To: Howard Melman, 75530; +Cc: Eli Zaretskii, Juri Linkov
Howard Melman <hmelman@gmail.com> writes:
> As I said in Emacs bug#16214 my preferred solution is to
> leave C-x C-q as is in all three modes and to standardize on
> e to enter the editable mode and C-c C-c to leave it.
>
> C-c C-c already does this in all three modes and e does this
> in occur and when I last looked was unbound in grep.
That bug predates Grep Edit’s addition for 31 and was discussing the
third-party Wgrep package. Fortunately Grep Edit does bind ‘e’ for
entry and and ‘C-c C-c’ for exit like Occur.
> The problem the last time was dired has e bound to dired-find-file but
> that command is already bound to f to and RET, so IMHO changing it for
> e is not a big deal (and of course I do that in my personal config).
> The argument last time was that changing a binding was too much, but I
> think that's weakened now as this patch did it.
I would be happy to send a replacement patch rebinding ‘e’ in Dired as
an alternative solution. I can’t imagine very many people are using it
instead of ‘f’ or ‘RET’. If we update NEWS I don’t see a huge problem
with changing a binding that already has not one but two equally
accessible alternatives. Objections, anyone?
^ permalink raw reply [flat|nested] 31+ messages in thread
end of thread, other threads:[~2025-02-06 1:19 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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-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 ` bug#75530: [PATCH v2.1 0/3] Consistently remap read-only-mode for special edit modes Liam Hupfer
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
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.