GNU bug report logs -
#75530
[PATCH 0/3] Consistently remap read-only-mode for special edit modes
Previous Next
To reply to this bug, email your comments to 75530 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Mon, 13 Jan 2025 00:58:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Liam Hupfer <liam <at> hpfr.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 13 Jan 2025 00:58:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Mon, 13 Jan 2025 01:02:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 75530 <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Mon, 13 Jan 2025 01:02:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 75530 <at> debbugs.gnu.org (full text, mbox):
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.
+
* 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Mon, 13 Jan 2025 01:02:03 GMT)
Full text and
rfc822 format available.
Message #14 received at 75530 <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Wed, 15 Jan 2025 07:30:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 75530 <at> debbugs.gnu.org (full text, mbox):
This looks great! Would be really sweet to get this one merged.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Sat, 18 Jan 2025 10:24:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 75530 <at> debbugs.gnu.org (full text, mbox):
> Cc: Liam Hupfer <liam <at> hpfr.net>
> From: Liam Hupfer <liam <at> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Sat, 18 Jan 2025 10:27:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 75530 <at> debbugs.gnu.org (full text, mbox):
> Cc: Liam Hupfer <liam <at> hpfr.net>
> From: Liam Hupfer <liam <at> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Sat, 18 Jan 2025 10:28:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 75530 <at> debbugs.gnu.org (full text, mbox):
> Cc: Liam Hupfer <liam <at> hpfr.net>
> From: Liam Hupfer <liam <at> 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?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Sun, 02 Feb 2025 19:23:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 75530 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Thanks for the review Eli!
Eli Zaretskii <eliz <at> 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Sun, 02 Feb 2025 19:31:02 GMT)
Full text and
rfc822 format available.
Message #32 received at 75530 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:
>> Cc: Liam Hupfer <liam <at> hpfr.net>
>> From: Liam Hupfer <liam <at> 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Sun, 02 Feb 2025 19:39:01 GMT)
Full text and
rfc822 format available.
Message #35 received at 75530 <at> debbugs.gnu.org (full text, mbox):
> From: Liam Hupfer <liam <at> hpfr.net>
> Cc: 75530 <at> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Sun, 02 Feb 2025 19:43:02 GMT)
Full text and
rfc822 format available.
Message #38 received at 75530 <at> debbugs.gnu.org (full text, mbox):
> From: Liam Hupfer <liam <at> hpfr.net>
> Cc: 75530 <at> 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?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Sun, 02 Feb 2025 20:28:01 GMT)
Full text and
rfc822 format available.
Message #41 received at 75530 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Mon, 03 Feb 2025 00:14:01 GMT)
Full text and
rfc822 format available.
Message #44 received at 75530 <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Mon, 03 Feb 2025 00:16:02 GMT)
Full text and
rfc822 format available.
Message #47 received at 75530 <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Mon, 03 Feb 2025 00:16:03 GMT)
Full text and
rfc822 format available.
Message #50 received at 75530 <at> debbugs.gnu.org (full text, mbox):
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.
+
* 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Mon, 03 Feb 2025 00:16:03 GMT)
Full text and
rfc822 format available.
Message #53 received at 75530 <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Mon, 03 Feb 2025 04:39:01 GMT)
Full text and
rfc822 format available.
Message #56 received at submit <at> debbugs.gnu.org (full text, mbox):
Liam Hupfer <liam <at> 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Mon, 03 Feb 2025 11:48:02 GMT)
Full text and
rfc822 format available.
Message #59 received at 75530 <at> debbugs.gnu.org (full text, mbox):
> From: Liam Hupfer <liam <at> hpfr.net>
> Cc: 75530 <at> 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...
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Tue, 04 Feb 2025 03:53:01 GMT)
Full text and
rfc822 format available.
Message #62 received at 75530 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Liam Hupfer <liam <at> hpfr.net>
>> Cc: 75530 <at> 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Tue, 04 Feb 2025 04:11:02 GMT)
Full text and
rfc822 format available.
Message #65 received at 75530 <at> debbugs.gnu.org (full text, mbox):
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 <at> 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 <at> 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.
+
* 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 <at> 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Tue, 04 Feb 2025 04:53:01 GMT)
Full text and
rfc822 format available.
Message #68 received at 75530 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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 <at> 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 <at> mail.jurta.org/>
[workflows] <https://xkcd.com/1172/>
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Tue, 04 Feb 2025 07:47:01 GMT)
Full text and
rfc822 format available.
Message #71 received at 75530 <at> debbugs.gnu.org (full text, mbox):
>> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Tue, 04 Feb 2025 16:13:02 GMT)
Full text and
rfc822 format available.
Message #74 received at 75530 <at> debbugs.gnu.org (full text, mbox):
> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Wed, 05 Feb 2025 05:28:02 GMT)
Full text and
rfc822 format available.
Message #77 received at 75530 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Juri Linkov <juri <at> 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!
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Wed, 05 Feb 2025 06:02:02 GMT)
Full text and
rfc822 format available.
Message #80 received at 75530 <at> debbugs.gnu.org (full text, mbox):
> 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?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Wed, 05 Feb 2025 07:48:02 GMT)
Full text and
rfc822 format available.
Message #83 received at 75530 <at> debbugs.gnu.org (full text, mbox):
>> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Wed, 05 Feb 2025 12:57:01 GMT)
Full text and
rfc822 format available.
Message #86 received at submit <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Wed, 05 Feb 2025 12:57:02 GMT)
Full text and
rfc822 format available.
Message #89 received at 75530 <at> debbugs.gnu.org (full text, mbox):
The following message is a courtesy copy of an article
that has been posted to gmane.emacs.bugs as well.
Juri Linkov <juri <at> 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Thu, 06 Feb 2025 00:59:01 GMT)
Full text and
rfc822 format available.
Message #92 received at 75530 <at> debbugs.gnu.org (full text, mbox):
Howard Melman <hmelman <at> 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?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Thu, 06 Feb 2025 01:20:02 GMT)
Full text and
rfc822 format available.
Message #95 received at 75530 <at> debbugs.gnu.org (full text, mbox):
Howard Melman <hmelman <at> 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?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Thu, 06 Feb 2025 17:15:01 GMT)
Full text and
rfc822 format available.
Message #98 received at 75530 <at> debbugs.gnu.org (full text, mbox):
>> 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.
Thanks for mentioning Grep Edit. Its grep-edit--prepare-buffer
puts read-only properties on line numbers only after switching
to Edit mode. And Occur Edit mode should do the same.
So now we have a better solution than was in bug#53419.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Fri, 07 Feb 2025 03:18:01 GMT)
Full text and
rfc822 format available.
Message #101 received at 75530 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
> Thanks for mentioning Grep Edit. Its grep-edit--prepare-buffer
> puts read-only properties on line numbers only after switching
> to Edit mode. And Occur Edit mode should do the same.
> So now we have a better solution than was in bug#53419.
Nice! Since making entry and exit from the three special writable modes
consistent is the goal of this bug, and we seem to have ruled out
remapping read-only-mode, I think Occur’s read-only properties are now
orthogonal to this bug and a good topic for a new one (or reopening
bug#53419?).
I’ll post a series dropping patches 2 and 3 and replacing them with a
patch rebinding ‘e’ in Dired based on the rationale Howard and I
discussed in the previous two messages.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75530
; Package
emacs
.
(Fri, 07 Feb 2025 03:33:01 GMT)
Full text and
rfc822 format available.
Message #104 received at 75530 <at> debbugs.gnu.org (full text, mbox):
Some people prefer to keep the read-only-mode binding in Grep and Occur
buffers. v3 instead rebinds ‘e’ in Dired to parallel Occur and Grep,
taking advantage of the fact that its previous binding is still
available on ‘RET’ and ‘f’.
Liam Hupfer (2):
Remap read-only-mode in wdired-mode-map (bug#75530)
Bind e in Dired to dired-toggle-read-only (bug#75530)
doc/emacs/dired.texi | 4 +---
etc/NEWS | 10 ++++++++++
lisp/dired.el | 2 +-
lisp/wdired.el | 2 +-
4 files changed, 13 insertions(+), 5 deletions(-)
base-commit: 1751739152149608d28853782ce53b0b9a749bb2
--
2.47.1
From e8fa2fe0da65221861d70d2d12f1516885172757 Mon Sep 17 00:00:00 2001
From: Liam Hupfer <liam <at> hpfr.net>
Date: Sun, 12 Jan 2025 12:24:38 -0600
Subject: [PATCH v3 1/2] 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 ade635aa924..c7d1f24e74d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -900,6 +900,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 3017b0496d8a68d18a93823d4935a1db25e4ea3a Mon Sep 17 00:00:00 2001
From: Liam Hupfer <liam <at> hpfr.net>
Date: Wed, 5 Feb 2025 19:28:06 -0600
Subject: [PATCH v3 2/2] Bind e in Dired to dired-toggle-read-only (bug#75530)
This parallels the entry points to Occur Edit and Grep Edit. C-c C-c,
the exit point for those two edit modes, is already bound to exit
Wdired.
* lisp/dired.el (dired-mode-map): Bind e to dired-toggle-read-only.
* etc/NEWS: Document the change.
* doc/emacs/dired.texi: Update the manual accordingly.
---
doc/emacs/dired.texi | 4 +---
etc/NEWS | 4 ++++
lisp/dired.el | 2 +-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index 07142e71713..779a27d8d4a 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -419,9 +419,7 @@ Visit the file described on the current line, like typing @kbd{C-x C-f}
and supplying that file name (@code{dired-find-file}). @xref{Visiting}.
@item @key{RET}
-@itemx e
@kindex RET @r{(Dired)}
-@kindex e @r{(Dired)}
Equivalent to @kbd{f}.
@ignore @c This command seems too risky to document at all.
@@ -1633,7 +1631,7 @@ and erases all flags and marks.
@findex wdired-change-to-wdired-mode
Wdired is a special mode that allows you to perform file operations
by editing the Dired buffer directly (the ``W'' in ``Wdired'' stands
-for ``writable''). To enter Wdired mode, type @kbd{C-x C-q}
+for ``writable''). To enter Wdired mode, type @kbd{C-x C-q} or @kbd{e}
(@code{dired-toggle-read-only}) while in a Dired buffer.
Alternatively, use the @samp{Immediate / Edit File Names} menu item.
diff --git a/etc/NEWS b/etc/NEWS
index c7d1f24e74d..4d13f19d626 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -906,6 +906,10 @@ 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.
+---
+*** 'e' is now bound to 'dired-toggle-read-only'.
+'dired-find-file' remains available on 'f' and 'RET'.
+
** Grep
+++
diff --git a/lisp/dired.el b/lisp/dired.el
index 91163186443..e4f9bcfcd24 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2394,7 +2394,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
;; Lower keys for commands not operating on all the marked files
"a" #'dired-find-alternate-file
"d" #'dired-flag-file-deletion
- "e" #'dired-find-file
+ "e" #'dired-toggle-read-only
"f" #'dired-find-file
"C-m" #'dired-find-file
"g" #'revert-buffer
--
2.47.1
This bug report was last modified 66 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.