unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
To: juri@jurta.org
Cc: 16214@debbugs.gnu.org, tkk@misasa.okayama-u.ac.jp,
	josh@foxtail.org, roland@hack.frob.com
Subject: bug#16214: Consistency in dired-, occur-, and grep-mode
Date: Wed, 25 Dec 2013 08:15:39 +0900 (JST)	[thread overview]
Message-ID: <20131225.081539.476633610.tkk@misasa.okayama-u.ac.jp> (raw)
In-Reply-To: <87fvpj5voe.fsf@mail.jurta.org>

>> 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)))





  reply	other threads:[~2013-12-24 23:15 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

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

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

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20131225.081539.476633610.tkk@misasa.okayama-u.ac.jp \
    --to=tkk@misasa.okayama-u.ac.jp \
    --cc=16214@debbugs.gnu.org \
    --cc=josh@foxtail.org \
    --cc=juri@jurta.org \
    --cc=roland@hack.frob.com \
    /path/to/YOUR_REPLY

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

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