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: tkk@misasa.okayama-u.ac.jp, Roland McGrath <roland@hack.frob.com>
Subject: bug#16214: Consistency in dired-, occur-, and grep-mode
Date: Sat, 21 Dec 2013 22:40:43 +0900 (JST)	[thread overview]
Message-ID: <20131221.224043.270400015.tkk@misasa.okayama-u.ac.jp> (raw)

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





             reply	other threads:[~2013-12-21 13:40 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-21 13:40 Tak Kunihiro [this message]
2013-12-21 19:23 ` bug#16214: Consistency in dired-, occur-, and grep-mode 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

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