[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#16214: Consistency in dired-, occur-, and grep-mode
From: |
Tak Kunihiro |
Subject: |
bug#16214: Consistency in dired-, occur-, and grep-mode |
Date: |
Sat, 21 Dec 2013 22:40:43 +0900 (JST) |
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)))
- bug#16214: Consistency in dired-, occur-, and grep-mode,
Tak Kunihiro <=
- bug#16214: Consistency in dired-, occur-, and grep-mode, Drew Adams, 2013/12/21
- bug#16214: Consistency in dired-, occur-, and grep-mode, Josh, 2013/12/21
- bug#16214: Consistency in dired-, occur-, and grep-mode, Juri Linkov, 2013/12/21
- bug#16214: Consistency in dired-, occur-, and grep-mode, Tak Kunihiro, 2013/12/22
- bug#16214: Consistency in dired-, occur-, and grep-mode, Juri Linkov, 2013/12/22
- bug#16214: Consistency in dired-, occur-, and grep-mode, Tak Kunihiro, 2013/12/23
- bug#16214: Consistency in dired-, occur-, and grep-mode, Juri Linkov, 2013/12/23
- bug#16214: Consistency in dired-, occur-, and grep-mode, Tak Kunihiro, 2013/12/24
- bug#16214: Consistency in dired-, occur-, and grep-mode, Juri Linkov, 2013/12/25
- bug#16214: Consistency in dired-, occur-, and grep-mode, Tak Kunihiro, 2013/12/28