Subject: bug#16214: Consistency in dired-, occur-, and grep-mode

From: Josh <[email-masked]>
Date: Sat, 21 Dec 2013 12:15:05 -0800

On Sat, Dec 21, 2013 at 5:40 AM, Tak Kunihiro
<[email-masked]> wrote:
> This is my first post to Emacs-related mailing list.  Roland suggested
> me to post here.  Apologize in advance if my behavior is something
> inappropriate.

Thanks for posting this!

> I am new to Emacs and use dired, occur, and grep everyday.  When I
> jump to a corresponding file from there, I do not pay much attention
> which mode I am at.
>
> I am eager to have similar interface with similar key-map in three
> modes.  I see some functions are missing in some modes.  Something
> like following will improve consistency among three major-modes.

I'd also like to see these modes' interfaces for similar functionality
become more consistent.  They already have similarities such as
binding `g' to logical refresh operations and further harmonization
would be great.

Another difference between their interfaces that I'd like to see
reconciled is the key binding to make these buffers editable, i.e. to
enable the functionality provided by Emacs' `wdired-mode' and
`occur-edit-mode', and the third-party wgrep library[0].  Though the
bindings to commit and abort edits are consistent between the three,
the enablement bindings are not.  I haven't managed to keep them
straight yet so I sometimes hit `e' in a dired buffer and end up
visiting the file at point instead of enabling wdired, and similarly
sometimes hit C-x C-q in an occur buffer which calls the standard
`read-only-mode' instead of enabling `occur-edit-mode'.

|------------+----------------------------+---------------------+----------------------|
| Mode       | Enable editing mode        | Commit/finish edits |
Abort edits          |
|------------+----------------------------+---------------------+----------------------|
| occur-edit | e                          | C-c C-c             | N/A
                |
|            | occur-edit-mode            | occur-cease-edit    |
                |
|------------+----------------------------+---------------------+----------------------|
| wdired     | C-x C-q                    | C-c C-c             | C-c
C-k              |
|            | dired-toggle-read-only     | wdired-finish-edit  |
wdired-abort-changes |
|------------+----------------------------+---------------------+----------------------|
| wgrep      | C-c C-p                    | C-c C-c             | C-c
C-k              |
|            | wgrep-change-to-wgrep-mode | wgrep-finish-edit   |
wgrep-abort-changes  |
|------------+----------------------------+---------------------+----------------------|

In regard to your proposed C-o and SPC bindings, I wonder if it would
be worthwhile to extend `next-error-follow-minor-mode' to support
dired, perhaps including the ability to restrict which files were
displayed via regexps or a function.

> Please consider my request to make fundamental interface of three
> major-modes to be more consistent by default.  Although key-map could
> be personal preference, and my code could be pretty bad, I hope this
> post will be a start.

Users can always customize bindings to suit their taste, but a
consistent set of defaults makes Emacs more accessible to new users
and makes guesses about where to find desired functionality more
likely to be correct.

> Best regards,
> Tak

[0] https://github.com/mhayashi1120/Emacs-wgrep

Cheers,
Josh