all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 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

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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.