* bug#16214: Consistency in dired-, occur-, and grep-mode
@ 2013-12-21 13:40 Tak Kunihiro
2013-12-21 19:23 ` Drew Adams
2013-12-21 20:15 ` Josh
0 siblings, 2 replies; 27+ messages in thread
From: Tak Kunihiro @ 2013-12-21 13:40 UTC (permalink / raw)
To: 16214; +Cc: tkk, Roland McGrath
Dear all,
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.
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.
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.
Best regards,
Tak
--
Dr Tak Kunihiro
Associate Professor, Okayama Univ
Misasa, Tottori 682-0193, Japan
http://dream.misasa.okayama-u.ac.jp
* Summary of key and possible function in three major-modes
"o"
|-------+-------------------------------------------|
| mode | fun |
|-------+-------------------------------------------|
| dired | (dired-find-file-other-window) |
| occur | (occur-mode-goto-occurrence-other-window) |
| grep | (compile-goto-error) |
|-------+-------------------------------------------|
"C-o"
|-------+------------------------------------|
| mode | fun |
|-------+------------------------------------|
| dired | (dired-display-file) |
| occur | (occur-mode-display-occurrence) |
| grep | (grep-mode-display-occurrence); *1 |
|-------+------------------------------------|
; *1
(defun grep-mode-display-occurrence ()
(interactive)
(let ((compilation-context-lines nil))
(setq compilation-current-error (point))
(next-error-no-select 0)))
<RETURN>
|-------+----------------------------------------------|
| mode | fun |
|-------+----------------------------------------------|
| dired | (dired-find-file) |
| occur | (occur-mode-goto-occurrence-this-window); *2 |
| grep | (compile-goto-error-this-window); *3 |
|-------+----------------------------------------------|
; *2
(defun occur-mode-goto-occurrence-this-window ()
"Go to the occurrence the current line describes, in this window."
(interactive)
(let ((pos (occur-mode-find-occurrence)))
;; (switch-to-buffer-other-window (marker-buffer pos))
(switch-to-buffer (marker-buffer pos))
(goto-char pos)
(run-hooks 'occur-mode-find-occurrence-hook)))
; *3
; http://stackoverflow.com/questions/15814031
(defun compile-goto-error-this-window ()
(interactive)
(let ((display-buffer-overriding-action
'(display-buffer-same-window
(inhibit-same-window . nil)))
(compilation-context-lines nil))
(setq compilation-current-error (point))
(compile-goto-error)))
<SPACE>
|-------+-----|
| mode | fun |
|-------+-----|
| dired | *4 |
| occur | *5 |
| grep | *6 |
|-------+-----|
; *4
(define-key grep-mode-map (kbd "SPC") '(lambda()
(interactive)
(ignore-errors (grep-mode-display-occurrence))
(next-line)))
; *5
(define-key dired-mode-map (kbd "SPC") '(lambda()
(interactive)
(dired-display-file)
(dired-next-line 1)))
; *6
(define-key occur-mode-map (kbd "SPC") '(lambda()
(interactive)
(ignore-errors (occur-mode-display-occurrence))
(next-line)))
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2013-12-21 13:40 bug#16214: Consistency in dired-, occur-, and grep-mode Tak Kunihiro
@ 2013-12-21 19:23 ` Drew Adams
2013-12-21 20:15 ` Josh
1 sibling, 0 replies; 27+ messages in thread
From: Drew Adams @ 2013-12-21 19:23 UTC (permalink / raw)
To: Tak Kunihiro, 16214; +Cc: Roland McGrath
While there might be room for some minor alignment, in general
it is not good to privilege standardization too highly here, IMO.
There are superficial similarities, and maybe some that are more than
superficial. But there are also different purposes and use patterns.
These are quite different modes when you look closely and take all
of what each does into account - its raison d'etre: what it is for.
Each should be handled case by case, with an eye to all of its
features and its overall set of use cases.
Dired, in particular, is extremely rich. Let us not start hobbling
it in the name of standardization.
With that caveat expressed, I have no big objection to what has
been proposed here so far. (I would prefer that SPC in Dired
remain what it is, but that's about it.)
But I would strongly recommend that we not go overboard with such
an approach - that would be quite misguided IMO.
The main guide for us should be the full set of features - and how
they interact - for each individual mode viewed on its own.
Let's keep in mind the most important rule regarding consistency:
Consistency *within* a given system/application/realm/area/function
is very important. Consistency *across* different areas is not so
important - essentially only a nice-to-have, permitted when other
things are in fact equal.
Consistency within an area involves/includes also how its parts
fit together. Individual parts (e.g. key sequences) should not
be considered only on their own - they are parts of a whole/system.
And even in the latter case, when we allow ourselves some added
consistency across areas, we should always keep that *tentative*.
A better idea that comes up later, based on reasons relevant to a
given domain itself, should trump any such cross-domain tentative
harmony we allowed before that better idea.
IOW, internal cohesion/meaning/relevance is in general a much more
important consideration than is external coupling/consistency/convention.
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2013-12-21 13:40 bug#16214: Consistency in dired-, occur-, and grep-mode Tak Kunihiro
2013-12-21 19:23 ` Drew Adams
@ 2013-12-21 20:15 ` Josh
2013-12-21 21:30 ` Juri Linkov
1 sibling, 1 reply; 27+ messages in thread
From: Josh @ 2013-12-21 20:15 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: 16214, Roland McGrath
On Sat, Dec 21, 2013 at 5:40 AM, Tak Kunihiro
<tkk@misasa.okayama-u.ac.jp> 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
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2013-12-21 20:15 ` Josh
@ 2013-12-21 21:30 ` Juri Linkov
2013-12-22 11:48 ` Tak Kunihiro
0 siblings, 1 reply; 27+ messages in thread
From: Juri Linkov @ 2013-12-21 21:30 UTC (permalink / raw)
To: Josh; +Cc: 16214, Tak Kunihiro, Roland McGrath
> 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.
Then help-mode could bind `g' to `revert-buffer' too, but the problem
is that then help-mode will be inconsistent with Info-mode where
`g' is bound to `Info-goto-node'.
> 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'.
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.
> 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.
This is possible, and then `M-g n' could visit the next file in a sequence,
and maybe the same key prefix could be used also for other binding
to make them more consistent, e.g. `M-g o' for `dired-find-file-other-window',
`M-g C-o' for `dired-display-file', etc.
> 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.
I'd also add the vc-dir mode to the list of modes to share
the same keybindings.
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2013-12-21 21:30 ` Juri Linkov
@ 2013-12-22 11:48 ` Tak Kunihiro
2013-12-22 21:44 ` Juri Linkov
0 siblings, 1 reply; 27+ messages in thread
From: Tak Kunihiro @ 2013-12-22 11:48 UTC (permalink / raw)
To: 16214; +Cc: josh, tkk, roland
Dear all,
Thank you for positive responses. It is also a relief to know that I
posted to an appropriate place.
To have consistency on edition of buffer at dired-/occur-/grep-mode,
(1) addition of two key-binds, "e" to both (dired-toggle-read-only)
and (wgrep-change-to-wgrep-mode), and (2) implementation of a function
(occur-abort-changes) will do it.
In this manner, addition of key-binds and implementation of several
functions will do it without breaking internal consistency. Modes,
functions, key-binds as-is, and key-binds plus, with feed-backs, are
summarized in Table 1. I think that there are just a little side
effects such as change in behavior of <RETURN> in grep-mode.
I checked *.el and summarized possible contacts in Table 2. Assuming a
consensus getting built up, what should be done for the next step to
make these by default?
Best regards,
Tak
--
Dr Tak Kunihiro
Associate Professor, Okayama Univ
Misasa, Tottori 682-0193, Japan
http://dream.misasa.okayama-u.ac.jp
Table 1: A summary of mode, function, key-bind as-is, and key-bind
plus to have consistency between dired-, occur-, grep-, help-, and
vc-dir-mode.
- key "o" and "C-o" may be "M-g o" and "M-g C-o"
- wgrep is at https://github.com/mhayashi1120/Emacs-wgrep
|--------+----------------------------------------------+-----------+-----------|
| mode | function | key-as-is | key-plus |
|--------+----------------------------------------------+-----------+-----------|
| ! | edit buffer (enable/finish/abort)
|--------+----------------------------------------------+-----------+-----------|
| wdired | (dired-toggle-read-only) | "C-x C-q" | "e" |
| wdired | (wdired-finish-edit) | "C-c C-c" | |
| wdired | (wdired-abort-changes) | "C-c C-k" | |
| occur | (occur-edit-mode) | "e" | |
| occur | (occur-cease-edit) | "C-c C-c" | |
| occur | ? | | "C-c C-k" |
| wgrep | (wgrep-change-to-wgrep-mode) | "C-c C-p" | "e" |
| wgrep | (wgrep-finish-edit) | "C-c C-c" | |
| wgrep | (wgrep-abort-changes) | "C-c C-k" | |
|--------+----------------------------------------------+-----------+-----------|
| ! | open in other window
|--------+----------------------------------------------+-----------+-----------|
| dired | (dired-find-file-other-window) | "o" | |
| occur | (occur-mode-goto-occurrence-other-window) | "o" | |
| grep | (compile-goto-error) | <RETURN> | "o" |
| help | ? | <RETURN> | "o" |
| vc-dir | ? | | |
|--------+----------------------------------------------+-----------+-----------|
| ! | open in other window no select
|--------+----------------------------------------------+-----------+-----------|
| dired | (dired-display-file) | "C-o" | |
| occur | (occur-mode-display-occurrence) | "C-o" | |
| grep | (grep-mode-display-occurrence); *1 | | "C-o" |
| help | ? | | "C-o" |
| vc-dir | ? | | |
|--------+----------------------------------------------+-----------+-----------|
| ! | open in this window
|--------+----------------------------------------------+-----------+-----------|
| dired | (dired-find-file) | <RETURN> | |
| occur | (occur-mode-goto-occurrence-this-window); *2 | | <RETURN> |
| grep | (compile-goto-error-this-window); *3 | | <RETURN> |
| help | ? | | |
| vc-dir | ? | | |
|--------+----------------------------------------------+-----------+-----------|
| ! | revert buffer
|--------+----------------------------------------------+-----------+-----------|
| dired | (revert-buffer) | "g" | |
| occur | (revert-buffer) | "g" | |
| grep | (recompile) | "g" | |
| help | (revert-buffer) | "g" | |
| vc-dir | ? | | |
|--------+----------------------------------------------+-----------+-----------|
| ! | open in other window with cursor moved
|--------+----------------------------------------------+-----------+-----------|
| dired | ? | | "C-c C-f" |
| occur | (next-error-follow-minor-mode) | "C-c C-f" | |
| grep | (next-error-follow-minor-mode) | "C-c C-f" | |
| help | ? | | |
| vc-dir | ? | | |
|--------+----------------------------------------------+-----------+-----------|
| ! | open in other window and go next matter
|--------+----------------------------------------------+-----------+-----------|
| dired | *4 | | <SPC> |
| occur | *5 | | <SPC> |
| grep | *6 | | <SPC> |
|--------+----------------------------------------------+-----------+-----------|
; *1
(defun grep-mode-display-occurrence ()
(interactive)
(let ((compilation-context-lines nil))
(setq compilation-current-error (point))
(next-error-no-select 0)))
; *2
(defun occur-mode-goto-occurrence-this-window ()
"Go to the occurrence the current line describes, in this window."
(interactive)
(let ((pos (occur-mode-find-occurrence)))
;; (switch-to-buffer-other-window (marker-buffer pos))
(switch-to-buffer (marker-buffer pos))
(goto-char pos)
(run-hooks 'occur-mode-find-occurrence-hook)))
; *3
; http://stackoverflow.com/questions/15814031
(defun compile-goto-error-this-window ()
(interactive)
(let ((display-buffer-overriding-action
'(display-buffer-same-window
(inhibit-same-window . nil)))
(compilation-context-lines nil))
(setq compilation-current-error (point))
(compile-goto-error)))
; *4
(define-key grep-mode-map (kbd "SPC") '(lambda()
(interactive)
(ignore-errors (grep-mode-display-occurrence))
(next-line)))
; *5
(define-key dired-mode-map (kbd "SPC") '(lambda()
(interactive)
(dired-display-file)
(dired-next-line 1)))
; *6
(define-key occur-mode-map (kbd "SPC") '(lambda()
(interactive)
(ignore-errors (occur-mode-display-occurrence))
(next-line)))
Table 2: A contact list for each mode
|--------+------------------------|
| mode | contact |
|--------+------------------------|
| occur | FSF |
| grep | FSF |
| dired | FSF |
| help | FSF |
| wdired | juanleon1@gmail.com |
| vc-dir | dann@ics.uci.edu |
| wgrep | mhayashi1120@gmail.com |
|--------+------------------------|
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2013-12-22 11:48 ` Tak Kunihiro
@ 2013-12-22 21:44 ` Juri Linkov
2013-12-23 11:34 ` Tak Kunihiro
2022-02-10 8:27 ` Lars Ingebrigtsen
0 siblings, 2 replies; 27+ messages in thread
From: Juri Linkov @ 2013-12-22 21:44 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: 16214, josh, roland
> To have consistency on edition of buffer at dired-/occur-/grep-mode,
> (1) addition of two key-binds, "e" to both (dired-toggle-read-only)
> and (wgrep-change-to-wgrep-mode), and (2) implementation of a function
> (occur-abort-changes) will do it.
I highly sympathize with your attempts to make keybindings consistent,
but please note that some existing keybindings can't be changed for
historical reasons. For example, `v' in Dired opens a file in view mode,
so often I type `v' in vc-dir, but it registers the file in version
control instead of opening in view mode. I have no idea how to avoid
this inconsistency.
Also `e' in Dired is used to open a file for editing, so `e' can't be
used to edit the Dired buffer. Maybe take some other key, e.g.
`M-e' (like in isearch) or `M-g e'.
Inconsistency in opening in other window between Dired ("o") and
occur/grep (<RET>) is a good inconsistency, because the primary
purpose of occur/grep is to open files in other window, so
more easy to type key <RET> is more suitable for occur/grep
to open a file in other window.
I see no harm in adding "o" (`compile-goto-error') to grep,
as grep already has `C-o' (`compilation-display-error')
to display grep hits in another window.
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2013-12-22 21:44 ` Juri Linkov
@ 2013-12-23 11:34 ` Tak Kunihiro
2013-12-23 21:52 ` Juri Linkov
2022-02-10 8:27 ` Lars Ingebrigtsen
1 sibling, 1 reply; 27+ messages in thread
From: Tak Kunihiro @ 2013-12-23 11:34 UTC (permalink / raw)
To: juri; +Cc: 16214, tkk, josh, roland
Thank you for the response.
> Inconsistency in opening in other window between Dired ("o") and
> occur/grep (<RET>) is a good inconsistency, because the primary
> purpose of occur/grep is to open files in other window, so
> more easy to type key <RET> is more suitable for occur/grep
> to open a file in other window.
I see. It sounds reasonable <RET> to be assigned to the primary
purpose. Following is when I think that to assign <RET> to
(open-file-this-window) is convenient.
1. On edition of <file-a> in a single window, I feel like
referring to sentences in a different file.
2. (grep) something, then *grep* pops up in (other-window).
3. I will find a line in file-b; move cursor to the line on *grep*
4. Hit <RET> then <file-b> pops up on the first window
5. The buffer <file-a> disappears then I lost.
Now I know that I have to prepare the third window before hit <RET>!
Assigning <RET> to (open-file-this-window) on occur/grep may loose
convenience, but helps new users because that behavior is similar to
following hyperlink in a web browser. After exercises, one can lean to
hit `o', which actually is more easy to type than <RET>. How do you
think about <RET> with considering new users?
Let me focus on dired/occur/grep with four functions (A-D) for
now. Proposed keys are summarized in Table 1.
A. edit-buffer
B. open-file-other-window
C. open-file-other-window-no-select
D. open-file-this-window
A. edit-buffer
To avoid overwriting `e' in dired, it seems that `C-x C-q' is the
second choice. Is `M-e' or `M-g e' better?
B. open-file-other-window
As you mentioned, add `o' to (compile-goto-error) will do it.
C. open-file-other-window-no-select
Same thing, add `C-o' to something like (compilation-display-error)
will do it.
D. open-file-this-window
Other candidates besides <RET> would be something like `M-<RET>' or 'M-o'?
Tak
Table 1: A proposed mode, function, key-bind as-is, and key-bind
plus to have consistency between dired-, occur-, and grep.
|--------+----------------------------------------------+---------------+-----------|
| mode | function | key-as-is | key-plus |
|--------+----------------------------------------------+---------------+-----------|
| ! | A. edit-buffer (enable/finish/abort) | | |
|--------+----------------------------------------------+---------------+-----------|
| wdired | (dired-toggle-read-only) | "C-x C-q" | |
| | (wdired-finish-edit) | "C-c C-c" | |
| | (wdired-abort-changes) | "C-c C-k" | |
| occur | (occur-edit-mode) | "e" | "C-x C-q" |
| | (occur-cease-edit) | "C-c C-c" | |
| | ? | | "C-c C-k" |
| wgrep | (wgrep-change-to-wgrep-mode) | "C-c C-p" | "C-x C-q" |
| | (wgrep-finish-edit) | "C-c C-c" | |
| | (wgrep-abort-changes) | "C-c C-k" | |
|--------+----------------------------------------------+---------------+-----------|
| ! | B. open-file-other-window | | |
|--------+----------------------------------------------+---------------+-----------|
| dired | (dired-find-file-other-window) | "o" | |
| occur | (occur-mode-goto-occurrence-other-window) | <RET> and "o" | |
| grep | (compile-goto-error) | <RET> | "o" |
|--------+----------------------------------------------+---------------+-----------|
| ! | C. open-file-other-window-no-select | | |
|--------+----------------------------------------------+---------------+-----------|
| dired | (dired-display-file) | "C-o" | |
| occur | (occur-mode-display-occurrence) | "C-o" | |
| grep | (grep-mode-display-occurrence); *1 | | "C-o" |
|--------+----------------------------------------------+---------------+-----------|
| ! | D. open-file-this-window | | |
|--------+----------------------------------------------+---------------+-----------|
| dired | (dired-find-file) | <RET> | ? |
| occur | (occur-mode-goto-occurrence-this-window); *2 | | ? |
| grep | (compile-goto-error-this-window); *3 | | ? |
|--------+----------------------------------------------+---------------+-----------|
| ! | Z. summary of function-assign-to-<RET> | | |
|--------+----------------------------------------------+---------------+-----------|
| dired | (dired-find-file) | <RET> | |
| occur | (occur-mode-goto-occurrence-other-window) | <RET> and "o" | |
| grep | (compile-goto-error) | <RET> | "o" |
|--------+----------------------------------------------+---------------+-----------|
; *1
(defun grep-mode-display-occurrence ()
(interactive)
(let ((compilation-context-lines nil))
(setq compilation-current-error (point))
(next-error-no-select 0)))
; *2
(defun occur-mode-goto-occurrence-this-window ()
"Go to the occurrence the current line describes, in this window."
(interactive)
(let ((pos (occur-mode-find-occurrence)))
;; (switch-to-buffer-other-window (marker-buffer pos))
(switch-to-buffer (marker-buffer pos))
(goto-char pos)
(run-hooks 'occur-mode-find-occurrence-hook)))
; *3
; http://stackoverflow.com/questions/15814031
(defun compile-goto-error-this-window ()
(interactive)
(let ((display-buffer-overriding-action
'(display-buffer-same-window
(inhibit-same-window . nil)))
(compilation-context-lines nil))
(setq compilation-current-error (point))
(compile-goto-error)))
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2013-12-23 11:34 ` Tak Kunihiro
@ 2013-12-23 21:52 ` Juri Linkov
2013-12-24 23:15 ` Tak Kunihiro
0 siblings, 1 reply; 27+ messages in thread
From: Juri Linkov @ 2013-12-23 21:52 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: 16214, josh, roland
> Assigning <RET> to (open-file-this-window) on occur/grep may loose
> convenience, but helps new users because that behavior is similar to
> following hyperlink in a web browser.
This behavior is similar to using History or Bookmarks window
in a web browser. For example, in Firefox typing `C-h' opens
the History list in the left side window (and C-b opens the
Bookmark list in the left side window). In the side window
you can press <RET> or click on a link name, and it will open
another page in the main window, replacing old page with a new
page. This is exactly like <RET> works in grep/occur buffers.
> A. edit-buffer
> To avoid overwriting `e' in dired, it seems that `C-x C-q' is the
> second choice. Is `M-e' or `M-g e' better?
Adding a new key is not better because it will be incompatible
with older versions.
> D. open-file-this-window
> Other candidates besides <RET> would be something like `M-<RET>' or 'M-o'?
For a key to use for this-window you could look at `C-x C-b' (list-buffers)
that binds the key `f' to `Buffer-menu-this-window'.
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2013-12-23 21:52 ` Juri Linkov
@ 2013-12-24 23:15 ` Tak Kunihiro
2013-12-25 20:57 ` Juri Linkov
0 siblings, 1 reply; 27+ messages in thread
From: Tak Kunihiro @ 2013-12-24 23:15 UTC (permalink / raw)
To: juri; +Cc: 16214, tkk, josh, roland
>> Assigning <RET> to (open-file-this-window) on occur/grep may loose
>> convenience, but helps new users because that behavior is similar to
>> following hyperlink in a web browser.
>
> This behavior is similar to using History or Bookmarks window
> in a web browser.
I see the analogy of behavior <RET> in occur/grep as a sidebar. Then
dired is shown on the main window of the web browser watching
directory structure of a web server.
>> A. edit-buffer
>> To avoid overwriting `e' in dired, it seems that `C-x C-q' is the
>> second choice. Is `M-e' or `M-g e' better?
>
> Adding a new key is not better because it will be incompatible
> with older versions.
How about to add `E' to edit buffer? It is close to `e' on occur, and
it seems that it is not used in any of dired/occur/wgrep yet.
>> D. open-file-this-window
>> Other candidates besides <RET> would be something like `M-<RET>' or 'M-o'?
>
> For a key to use for this-window you could look at `C-x C-b' (list-buffers)
> that binds the key `f' to `Buffer-menu-this-window'.
To assign `f' sounds very nice. Now proposed keys are summarized in
Table 1.
Table 1: A proposed mode, function, key-bind as-is, and key-bind
plus to have consistency between dired-, occur-, and grep.
|--------+----------------------------------------------+---------------+-----------|
| mode | function | key-as-is | key-plus |
|--------+----------------------------------------------+---------------+-----------|
| ! | A. edit-buffer (enable/finish/abort) | | |
|--------+----------------------------------------------+---------------+-----------|
| wdired | (dired-toggle-read-only) | "C-x C-q" | "E" |
| | (wdired-finish-edit) | "C-c C-c" | |
| | (wdired-abort-changes) | "C-c C-k" | |
| occur | (occur-edit-mode) | "e" | "E" |
| | (occur-cease-edit) | "C-c C-c" | |
| | ? | | "C-c C-k" |
| wgrep | (wgrep-change-to-wgrep-mode) | "C-c C-p" | "E" |
| | (wgrep-finish-edit) | "C-c C-c" | |
| | (wgrep-abort-changes) | "C-c C-k" | |
|--------+----------------------------------------------+---------------+-----------|
| ! | B. open-file-other-window | | |
|--------+----------------------------------------------+---------------+-----------|
| dired | (dired-find-file-other-window) | "o" | |
| occur | (occur-mode-goto-occurrence-other-window) | <RET> and "o" | |
| grep | (compile-goto-error) | <RET> | "o" |
|--------+----------------------------------------------+---------------+-----------|
| ! | C. open-file-other-window-no-select | | |
|--------+----------------------------------------------+---------------+-----------|
| dired | (dired-display-file) | "C-o" | |
| occur | (occur-mode-display-occurrence) | "C-o" | |
| grep | (grep-mode-display-occurrence); *1 | | "C-o" |
|--------+----------------------------------------------+---------------+-----------|
| ! | D. open-file-this-window | | |
|--------+----------------------------------------------+---------------+-----------|
| dired | (dired-find-file) | <RET> and "f" | |
| occur | (occur-mode-goto-occurrence-this-window); *2 | | "f" |
| grep | (compile-goto-error-this-window); *3 | | "f" |
|--------+----------------------------------------------+---------------+-----------|
| ! | Z. summary of function-assign-to-<RET> | | |
|--------+----------------------------------------------+---------------+-----------|
| dired | (dired-find-file) | <RET> and "f" | |
| occur | (occur-mode-goto-occurrence-other-window) | <RET> and "o" | |
| grep | (compile-goto-error) | <RET> | "o" |
|--------+----------------------------------------------+---------------+-----------|
; *1
(defun grep-mode-display-occurrence ()
(interactive)
(let ((compilation-context-lines nil))
(setq compilation-current-error (point))
(next-error-no-select 0)))
; *2
(defun occur-mode-goto-occurrence-this-window ()
"Go to the occurrence the current line describes, in this window."
(interactive)
(let ((pos (occur-mode-find-occurrence)))
;; (switch-to-buffer-other-window (marker-buffer pos))
(switch-to-buffer (marker-buffer pos))
(goto-char pos)
(run-hooks 'occur-mode-find-occurrence-hook)))
; *3
; http://stackoverflow.com/questions/15814031
(defun compile-goto-error-this-window ()
(interactive)
(let ((display-buffer-overriding-action
'(display-buffer-same-window
(inhibit-same-window . nil)))
(compilation-context-lines nil))
(setq compilation-current-error (point))
(compile-goto-error)))
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2013-12-24 23:15 ` Tak Kunihiro
@ 2013-12-25 20:57 ` Juri Linkov
2013-12-28 9:57 ` Tak Kunihiro
0 siblings, 1 reply; 27+ messages in thread
From: Juri Linkov @ 2013-12-25 20:57 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: 16214, josh, roland
> How about to add `E' to edit buffer? It is close to `e' on occur, and
> it seems that it is not used in any of dired/occur/wgrep yet.
Maybe we could use the same key `C-x C-q' for `occur-edit-mode', and
improve it in such a way that it doesn't cause unexpected results
when the user intends to edit just the *Occur* buffer, and not its
associated source buffers.
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2013-12-25 20:57 ` Juri Linkov
@ 2013-12-28 9:57 ` Tak Kunihiro
0 siblings, 0 replies; 27+ messages in thread
From: Tak Kunihiro @ 2013-12-28 9:57 UTC (permalink / raw)
To: juri; +Cc: 16214, tkk, josh, roland
Dear Juri,
>> How about to add `E' to edit buffer? It is close to `e' on occur, and
>> it seems that it is not used in any of dired/occur/wgrep yet.
>
> Maybe we could use the same key `C-x C-q' for `occur-edit-mode', and
> improve it in such a way that it doesn't cause unexpected results
> when the user intends to edit just the *Occur* buffer, and not its
> associated source buffers.
Thank you for the reply. Current proposed keys are summarized in
Table 1. Honestly, I am not capable to improve *Occur* and even I do
not know how I proceed for the next step including technical aspects
as described on www.emacswiki.org/emacs/BzrForEmacsCasualDevs.
Could you give me a suggestion?
Best regards,
Tak
Table 1: A proposed mode, function, key-bind as-is, and key-bind
plus to have consistency between dired-, occur-, and grep.
|--------+-------------------------------------------+---------------+-----------|
| mode | function | key-as-is | key-plus |
|--------+-------------------------------------------+---------------+-----------|
| ! | A. edit-buffer (enable/finish/abort) | | |
|--------+-------------------------------------------+---------------+-----------|
| wdired | (dired-toggle-read-only) | "C-x C-q" | |
| | (wdired-finish-edit) | "C-c C-c" | |
| | (wdired-abort-changes) | "C-c C-k" | |
| occur | (occur-edit-mode)* | "e" | "C-x C-q" |
| | (occur-cease-edit) | "C-c C-c" | |
| | n/a | | "C-c C-k" |
| wgrep | (wgrep-change-to-wgrep-mode) | "C-c C-p" | "C-x C-q" |
| | (wgrep-finish-edit) | "C-c C-c" | |
| | (wgrep-abort-changes) | "C-c C-k" | |
|--------+-------------------------------------------+---------------+-----------|
| ! | B. open-file-other-window | | |
|--------+-------------------------------------------+---------------+-----------|
| dired | (dired-find-file-other-window) | "o" | |
| occur | (occur-mode-goto-occurrence-other-window) | <RET> and "o" | |
| grep | (compile-goto-error) | <RET> | "o" |
|--------+-------------------------------------------+---------------+-----------|
| ! | C. open-file-other-window-no-select | | |
|--------+-------------------------------------------+---------------+-----------|
| dired | (dired-display-file) | "C-o" | |
| occur | (occur-mode-display-occurrence) | "C-o" | |
| grep | n/a | | "C-o" |
|--------+-------------------------------------------+---------------+-----------|
| ! | D. open-file-this-window | | |
|--------+-------------------------------------------+---------------+-----------|
| dired | (dired-find-file) | <RET> and "f" | |
| occur | n/a | | "f" |
| grep | n/a | | "f" |
|--------+-------------------------------------------+---------------+-----------|
| ! | Z. summary of function-assign-to-<RET> | | |
|--------+-------------------------------------------+---------------+-----------|
| dired | (dired-find-file) | <RET> and "f" | |
| occur | (occur-mode-goto-occurrence-other-window) | <RET> and "o" | |
| grep | (compile-goto-error) | <RET> | "o" |
|--------+-------------------------------------------+---------------+-----------|
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2013-12-22 21:44 ` Juri Linkov
2013-12-23 11:34 ` Tak Kunihiro
@ 2022-02-10 8:27 ` Lars Ingebrigtsen
2022-02-10 9:26 ` Tak Kunihiro
` (2 more replies)
1 sibling, 3 replies; 27+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-10 8:27 UTC (permalink / raw)
To: Juri Linkov; +Cc: 16214, roland, Tak Kunihiro, josh
Juri Linkov <juri@jurta.org> writes:
> I highly sympathize with your attempts to make keybindings consistent,
> but please note that some existing keybindings can't be changed for
> historical reasons. For example, `v' in Dired opens a file in view mode,
> so often I type `v' in vc-dir, but it registers the file in version
> control instead of opening in view mode. I have no idea how to avoid
> this inconsistency.
(I'm going through old bug reports that unfortunately weren't resolved
at the time.)
If these modes were designed today, then having the keys be more
consistent would indeed be a priority. However, these bindings have
been around for decades, and changing them would break the muscle memory
of many people, and be highly annoying, so we can't do that.
Individual users are free to rebind these as they wish, of course, and
somebody properly motivated could make an ELPA package to unify these
bindings, but I don't think there's anything realistic that can be done
on the Emacs side here, so I'm therefore closing this bug report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2022-02-10 8:27 ` Lars Ingebrigtsen
@ 2022-02-10 9:26 ` Tak Kunihiro
2022-02-10 11:37 ` Lars Ingebrigtsen
2022-02-12 3:57 ` Richard Stallman
2022-02-12 19:12 ` Howard Melman
2 siblings, 1 reply; 27+ messages in thread
From: Tak Kunihiro @ 2022-02-10 9:26 UTC (permalink / raw)
To: larsi; +Cc: roland, 16214, tkk, josh
>> I highly sympathize with your attempts to make keybindings consistent,
>> but please note that some existing keybindings can't be changed for
>> historical reasons. For example, `v' in Dired opens a file in view mode,
>> so often I type `v' in vc-dir, but it registers the file in version
>> control instead of opening in view mode. I have no idea how to avoid
>> this inconsistency.
>
> Individual users are free to rebind these as they wish, of course, and
> somebody properly motivated could make an ELPA package to unify these
> bindings, ...
I agree. I have configured mine and I am satisfied with it. However,
I remember now, how hard it was. As context menu was introduced, it
is good for Emacs to be friendly.
To have an ELPA package to offer a minor mode to offer consistent key
bindings is a good idea.
How about listing this project to (info "(emacs) Contributing")?
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2022-02-10 9:26 ` Tak Kunihiro
@ 2022-02-10 11:37 ` Lars Ingebrigtsen
2022-02-11 5:54 ` Tak Kunihiro
0 siblings, 1 reply; 27+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-10 11:37 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: 16214, roland, josh
Tak Kunihiro <tkk@misasa.okayama-u.ac.jp> writes:
> To have an ELPA package to offer a minor mode to offer consistent key
> bindings is a good idea.
>
> How about listing this project to (info "(emacs) Contributing")?
It's not something that we'd have in Emacs itself, so I don't think
listing it there would be appropriate.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2022-02-10 11:37 ` Lars Ingebrigtsen
@ 2022-02-11 5:54 ` Tak Kunihiro
0 siblings, 0 replies; 27+ messages in thread
From: Tak Kunihiro @ 2022-02-11 5:54 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: roland, 16214, 国広卓也, josh
>> To have an ELPA package to offer a minor mode to offer consistent key
>> bindings is a good idea.
>>
>> How about listing this project to (info "(emacs) Contributing")?
>
> It's not something that we'd have in Emacs itself, so I don't think
> listing it there would be appropriate.
I agree. Then how about 'emacs/etc/TODO’? Is there a good place?
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2022-02-10 8:27 ` Lars Ingebrigtsen
2022-02-10 9:26 ` Tak Kunihiro
@ 2022-02-12 3:57 ` Richard Stallman
2022-02-12 8:16 ` Michael Albinus
2022-02-12 19:12 ` Howard Melman
2 siblings, 1 reply; 27+ messages in thread
From: Richard Stallman @ 2022-02-12 3:57 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 16214, tkk, roland, josh
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> For example, `v' in Dired opens a file in view mode,
> > so often I type `v' in vc-dir, but it registers the file in version
> > control instead of opening in view mode. I have no idea how to avoid
> > this inconsistency.
I suspect that v in vc-dir is used rarely enough that people would
not object to a change.
But there is nothing in Dired comparable to "registering" a file,
so whatever key vc-dir uses for this will not be comparable
to the meaning of that same key in Dired. So maybe this mini-problem
can't be avoided.
Maybe a better fix would be to make v in vc-dir ask for confirmation.
(I don't know whether it already does that; I may never have used it.)
At least this way typing v by mistake won't cause much trouble.
--
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2022-02-12 3:57 ` Richard Stallman
@ 2022-02-12 8:16 ` Michael Albinus
2022-02-14 4:13 ` Richard Stallman
0 siblings, 1 reply; 27+ messages in thread
From: Michael Albinus @ 2022-02-12 8:16 UTC (permalink / raw)
To: Richard Stallman; +Cc: 16214, Lars Ingebrigtsen, tkk, roland, josh
Richard Stallman <rms@gnu.org> writes:
Hi Richard,
> > For example, `v' in Dired opens a file in view mode,
> > > so often I type `v' in vc-dir, but it registers the file in version
> > > control instead of opening in view mode. I have no idea how to avoid
> > > this inconsistency.
>
> I suspect that v in vc-dir is used rarely enough that people would
> not object to a change.
I use it every single day, and often. Like other people who aren't using
magit (but I don't know whether this are many people these days).
> Maybe a better fix would be to make v in vc-dir ask for confirmation.
> (I don't know whether it already does that; I may never have used it.)
> At least this way typing v by mistake won't cause much trouble.
There is already some interactive ping-pong, because you have to provide
some text, depending on what vc-next-action (the command bound to v in
vc-dir) intends to do.
Best regards, Michael.
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2022-02-10 8:27 ` Lars Ingebrigtsen
2022-02-10 9:26 ` Tak Kunihiro
2022-02-12 3:57 ` Richard Stallman
@ 2022-02-12 19:12 ` Howard Melman
2022-02-12 20:43 ` Howard Melman
2 siblings, 1 reply; 27+ messages in thread
From: Howard Melman @ 2022-02-12 19:12 UTC (permalink / raw)
To: 16214
Lars Ingebrigtsen <larsi@gnus.org> writes:
> If these modes were designed today, then having the keys be more
> consistent would indeed be a priority. However, these bindings have
> been around for decades, and changing them would break the muscle memory
> of many people, and be highly annoying, so we can't do that.
I understand though am diaappointed. I'd argue my muscle
memory would be improved if I didn't have to remember three
different sets of some these similar bindings. And of
course existing users are able to rebind them if they wish
and are certainly more able to do so than new users. But
this argument has been made before.
> Individual users are free to rebind these as they wish, of course, and
> somebody properly motivated could make an ELPA package to unify these
> bindings, but I don't think there's anything realistic that can be done
> on the Emacs side here, so I'm therefore closing this bug report.
FWIW I do the following:
(with-eval-after-load 'grep-mode
(define-key grep-mode-map (kbd "o") #'compile-goto-error)
(define-key grep-mode-map (kbd "C-o") #'compilation-display-error))
I think adding these binding to emacs wouldn't break
any muscle memory and would unify at least two categories.
I'd also love to see one common way of entering wdired,
occur-edit and wgrep. The burden of maintaining this muscle
memory is IMHO silly.
--
Howard
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2022-02-12 19:12 ` Howard Melman
@ 2022-02-12 20:43 ` Howard Melman
2022-02-14 4:14 ` Richard Stallman
2022-02-17 16:28 ` Howard Melman
0 siblings, 2 replies; 27+ messages in thread
From: Howard Melman @ 2022-02-12 20:43 UTC (permalink / raw)
To: 16214
Howard Melman <hmelman@gmail.com> writes:
> I'd also love to see one common way of entering wdired,
> occur-edit and wgrep. The burden of maintaining this muscle
> memory is IMHO silly.
Actually, I this think is still viable:
> To have consistency on edition of buffer at dired-/occur-/grep-mode,
> (1) addition of two key-binds, "e" to both (dired-toggle-read-only)
> and (wgrep-change-to-wgrep-mode)
In occur-mode `e` already enters `occur-edit mode`.
In grep-mode `e` is unbound. `wgrep` is in nongnu elpa so I don't
know if `grep-mode` can reference it. But if not, perhaps it could
reserve this key for a wgrep-like function with a comment. `wgrep`
could be updated to add the binding or just document it as a
possibility.
In dired-mode `dired-toggle-read-only` is bound to `C-x C-q`
and `dired-find-file` is bound to `e`, `f` *and* `RET` (and
`f` is the one the emacs manual mentions first). If just
`e` were changed to invoke `dired-toggle-read-only` then
existing users in `dired-mode` can still use `f` and `RET`
to edit a file or rebind `e`.
Changing just one binding which already has two other equally
convenient (single key) and intuitive bindings doesn't seem too
invasive IMHO to fix something that, as you say, if it were designed
today would indeed be a priority.
--
Howard
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2022-02-12 8:16 ` Michael Albinus
@ 2022-02-14 4:13 ` Richard Stallman
2022-02-14 6:52 ` Michael Albinus
0 siblings, 1 reply; 27+ messages in thread
From: Richard Stallman @ 2022-02-14 4:13 UTC (permalink / raw)
To: Michael Albinus; +Cc: 16214, larsi, tkk, roland, josh
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> > I suspect that v in vc-dir is used rarely enough that people would
> > not object to a change.
> I use it every single day, and often. Like other people who aren't using
> magit (but I don't know whether this are many people these days).
I am not sure how to interpret that. Are you saying that
you intentionally type v (in vc-dir) every day?
Or that you accidentally type v (in vc-dir) every day?
I it is the former, I am surprised that you create a new file every
day. When I was working on software, I would make changes every day,
but new files were rare. How is it that you have such frequent
occasions to put a new file into version control? I'd like to
understand what leads to this.
> > Maybe a better fix would be to make v in vc-dir ask for confirmation.
> > (I don't know whether it already does that; I may never have used it.)
> > At least this way typing v by mistake won't cause much trouble.
> There is already some interactive ping-pong, because you have to provide
> some text, depending on what vc-next-action (the command bound to v in
> vc-dir) intends to do.
That being so, I would surmise that when you type v by accident,
nothing very bad happens -- you get asked for input and you type C-g,
right?
--
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2022-02-12 20:43 ` Howard Melman
@ 2022-02-14 4:14 ` Richard Stallman
2022-02-17 16:28 ` Howard Melman
1 sibling, 0 replies; 27+ messages in thread
From: Richard Stallman @ 2022-02-14 4:14 UTC (permalink / raw)
To: Howard Melman; +Cc: 16214
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> In grep-mode `e` is unbound. `wgrep` is in nongnu elpa so I don't
> know if `grep-mode` can reference it. But if not, perhaps it could
> reserve this key for a wgrep-like function with a comment. `wgrep`
> could be updated to add the binding or just document it as a
> possibility.
Thanks for being sensitive to this important point.
NonGNU ELPA are for add-ons that are not part of GNU Emacs. To keep
ourselves honest, we shouldn't treat them as part of it for one
purpose while treating them as not part of it for another purpose.
We can't have it both ways.
So we shouldn't design Grep mode based on presuming that wgrep is
part of the editor.
If we want to have that, we should do the work to make that
functionality available within GNU Emacs.
--
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2022-02-14 4:13 ` Richard Stallman
@ 2022-02-14 6:52 ` Michael Albinus
2022-02-15 4:30 ` Richard Stallman
0 siblings, 1 reply; 27+ messages in thread
From: Michael Albinus @ 2022-02-14 6:52 UTC (permalink / raw)
To: Richard Stallman; +Cc: 16214, larsi, tkk, roland, josh
Richard Stallman <rms@gnu.org> writes:
Hi Richard,
> > > I suspect that v in vc-dir is used rarely enough that people would
> > > not object to a change.
>
> > I use it every single day, and often. Like other people who aren't using
> > magit (but I don't know whether this are many people these days).
>
> I am not sure how to interpret that. Are you saying that
> you intentionally type v (in vc-dir) every day?
> Or that you accidentally type v (in vc-dir) every day?
The former.
> I it is the former, I am surprised that you create a new file every
> day. When I was working on software, I would make changes every day,
> but new files were rare. How is it that you have such frequent
> occasions to put a new file into version control? I'd like to
> understand what leads to this.
'v' in vc-dired means 'vc-next-action'. It does whatever vc command is
appropriate at the given context. In my use case, I apply it in order to
commit a file or fileset. Every single day.
> > > Maybe a better fix would be to make v in vc-dir ask for confirmation.
> > > (I don't know whether it already does that; I may never have used it.)
> > > At least this way typing v by mistake won't cause much trouble.
>
> > There is already some interactive ping-pong, because you have to provide
> > some text, depending on what vc-next-action (the command bound to v in
> > vc-dir) intends to do.
>
> That being so, I would surmise that when you type v by accident,
> nothing very bad happens -- you get asked for input and you type C-g,
> right?
Yes. That's why I vote to keep the 'v' key binding for vc-dired buffers.
Best regards, Michael.
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2022-02-14 6:52 ` Michael Albinus
@ 2022-02-15 4:30 ` Richard Stallman
0 siblings, 0 replies; 27+ messages in thread
From: Richard Stallman @ 2022-02-15 4:30 UTC (permalink / raw)
To: Michael Albinus; +Cc: 16214, larsi, tkk, roland, josh
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> > I it is the former, I am surprised that you create a new file every
> > day. When I was working on software, I would make changes every day,
> > but new files were rare. How is it that you have such frequent
> > occasions to put a new file into version control? I'd like to
> > understand what leads to this.
> 'v' in vc-dired means 'vc-next-action'. It does whatever vc command is
> appropriate at the given context. In my use case, I apply it in order to
> commit a file or fileset. Every single day.
Boy am I spaced! I knew that command, but didn't recall it. All I
was thinking about was the previous messages which talked about v as
registering a file.
Sorry for the confusion.
--
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2022-02-12 20:43 ` Howard Melman
2022-02-14 4:14 ` Richard Stallman
@ 2022-02-17 16:28 ` Howard Melman
2022-02-17 17:12 ` bug#16214: [External] : " Drew Adams
2022-02-20 1:43 ` Tak Kunihiro
1 sibling, 2 replies; 27+ messages in thread
From: Howard Melman @ 2022-02-17 16:28 UTC (permalink / raw)
To: 16214
I wish this got more traction so here's a small concrete proposal.
I think in all three RET already opens the file or line
under point (in dired changing the current window, in grep
and occur in another window, at least for me on the macport
of Emacs 27.2). No changes here.
With this one change, o in any of them will open the thing
in another window and select that window:
(define-key compilation-minor-mode-map (kbd "o") #'compile-goto-error)
C-o in all three already opens the thing in another window
but not select it, no changes here.
I propose no change to C-x C-q in any of the modes, some
want just to toggle read-only, dired already enters wdired.
This makes e enter a writable version of all three modes.
Reserve e in grep-mode (it's already unbound) for a writable
version like wdired or occur-edit via a comment or
documentation, no code change, no need to mention wgrep in
emacs proper. The wgrep package or users can perhaps bind e
to wgrep-change-to-wgrep-mode. Make one incompatible change
to dired:
(define-key dired-mode-map (kbd "e") #'dired-toggle-read-only)
Dired users with existing muscle memory to enter wdired via
C-x C-q are unchanged. Dired users that use f or RET to
edit a file are unchanged; those that use e to edit a file
will have to change or bind this themselves. The emacs
manual already documents using f to find a file from dired
and describes RET and e, in that order, as duplicates of f.
With this, e will change to be a duplicate of C-x C-q.
In all three you use C-c C-c to apply the edits, no changes
here.
That's it. 1 comment, 1 new binding and 1 changed binding
that already has two other equally convenient (single key)
and intuitive bindings. This would make RET, o, C-o, and e
consistent in all three as well as saving changes via C-c
C-c. I think this will be much easier for new and existing
users to remember.
--
Howard
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: [External] : bug#16214: Consistency in dired-, occur-, and grep-mode
2022-02-17 16:28 ` Howard Melman
@ 2022-02-17 17:12 ` Drew Adams
2022-02-20 1:43 ` Tak Kunihiro
1 sibling, 0 replies; 27+ messages in thread
From: Drew Adams @ 2022-02-17 17:12 UTC (permalink / raw)
To: Howard Melman, 16214@debbugs.gnu.org
> Dired users with existing muscle memory to enter wdired via
> C-x C-q are unchanged. Dired users that use f or RET to
> edit a file are unchanged; those that use e to edit a file
> will have to change or bind this themselves. The emacs
> manual already documents using f to find a file from dired
> and describes RET and e, in that order, as duplicates of f.
> With this, e will change to be a duplicate of C-x C-q.
FWIW -
I don't think `e' in Dired should do what `C-x C-q'
does. I don't think we ever need a duplicate default
binding for what `C-x C-q' does.
Dired can do lots of things, and can have _lots_ of
default key bindings. I don't see a good reason to
try to make its bindings correspond to those of
`occur' or `grep-mode'. Same thing for those two
modes - they can have lots of bindings that are
specific to their own features.
We gave global key bindings for a reason. That's
the place to provide keys we want to be common
across modes (by default).
___
FWIW, in Dired+ `e' isn't the same as `f'.
`e' is instead a toggle for showing the file:
View the file on this line in another window in the same frame.
If it was not already shown there then kill the previous buffer
visited by a `diredp-visit-*' command.
If it was already shown there, and if it and Dired are the only
windows there, then delete its window (toggle : show/hide the file).
Commands `diredp-visit-(next|previous)-file' are
bound to `C-(down|up)'.
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2022-02-17 16:28 ` Howard Melman
2022-02-17 17:12 ` bug#16214: [External] : " Drew Adams
@ 2022-02-20 1:43 ` Tak Kunihiro
2022-02-20 18:17 ` Howard Melman
1 sibling, 1 reply; 27+ messages in thread
From: Tak Kunihiro @ 2022-02-20 1:43 UTC (permalink / raw)
To: 16214; +Cc: tkk
> I think this will be much easier for new and existing users to
> remember.
Good idea. However, to change default is another step. I think that the
first step is (1) to write a global minor mode to provide the consistent
keymap. (2) Then install on ELPA. After a while, (3) include in main
body. (4) After a while, suggest to turn the minor mode on by default.
I cannot initiate such project now. Thus I want to post this project in
somewhere so that someone who wants to contribute Emacs can notice this.
^ permalink raw reply [flat|nested] 27+ messages in thread
* bug#16214: Consistency in dired-, occur-, and grep-mode
2022-02-20 1:43 ` Tak Kunihiro
@ 2022-02-20 18:17 ` Howard Melman
0 siblings, 0 replies; 27+ messages in thread
From: Howard Melman @ 2022-02-20 18:17 UTC (permalink / raw)
To: 16214
Tak Kunihiro <homeros.misasa@gmail.com> writes:
>> I think this will be much easier for new and existing users to
>> remember.
>
> Good idea.
Thanks.
> However, to change default is another step. I think that the
> first step is (1) to write a global minor mode to provide the consistent
> keymap. (2) Then install on ELPA. After a while, (3) include in main
> body. (4) After a while, suggest to turn the minor mode on by default.
>
> I cannot initiate such project now. Thus I want to post this project in
> somewhere so that someone who wants to contribute Emacs can notice this.
This seems like an awful lot of overhead to change one
binding that already has two other similar bindings that
aren't changing.
--
Howard
^ permalink raw reply [flat|nested] 27+ messages in thread
end of thread, other threads:[~2022-02-20 18:17 UTC | newest]
Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-21 13:40 bug#16214: Consistency in dired-, occur-, and grep-mode Tak Kunihiro
2013-12-21 19:23 ` Drew Adams
2013-12-21 20:15 ` Josh
2013-12-21 21:30 ` Juri Linkov
2013-12-22 11:48 ` Tak Kunihiro
2013-12-22 21:44 ` Juri Linkov
2013-12-23 11:34 ` Tak Kunihiro
2013-12-23 21:52 ` Juri Linkov
2013-12-24 23:15 ` Tak Kunihiro
2013-12-25 20:57 ` Juri Linkov
2013-12-28 9:57 ` Tak Kunihiro
2022-02-10 8:27 ` Lars Ingebrigtsen
2022-02-10 9:26 ` Tak Kunihiro
2022-02-10 11:37 ` Lars Ingebrigtsen
2022-02-11 5:54 ` Tak Kunihiro
2022-02-12 3:57 ` Richard Stallman
2022-02-12 8:16 ` Michael Albinus
2022-02-14 4:13 ` Richard Stallman
2022-02-14 6:52 ` Michael Albinus
2022-02-15 4:30 ` Richard Stallman
2022-02-12 19:12 ` Howard Melman
2022-02-12 20:43 ` Howard Melman
2022-02-14 4:14 ` Richard Stallman
2022-02-17 16:28 ` Howard Melman
2022-02-17 17:12 ` bug#16214: [External] : " Drew Adams
2022-02-20 1:43 ` Tak Kunihiro
2022-02-20 18:17 ` Howard Melman
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).