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

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






  reply	other threads:[~2013-12-22 11:48 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 [this message]
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

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=20131222.204850.283027925.tkk@misasa.okayama-u.ac.jp \
    --to=tkk@misasa.okayama-u.ac.jp \
    --cc=16214@debbugs.gnu.org \
    --cc=josh@foxtail.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).