Package: emacs;
Reported by: Tak Kunihiro <tkk <at> misasa.okayama-u.ac.jp>
Date: Sat, 21 Dec 2013 18:21:03 UTC
Severity: wishlist
Tags: wontfix
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
View this message in rfc822 format
From: Tak Kunihiro <tkk <at> misasa.okayama-u.ac.jp> To: 16214 <at> debbugs.gnu.org Cc: juri <at> jurta.org, josh <at> foxtail.org, tkk <at> misasa.okayama-u.ac.jp, drew.adams <at> oracle.com, roland <at> hack.frob.com Subject: bug#16214: Consistency in dired-, occur-, and grep-mode Date: Sun, 22 Dec 2013 20:48:50 +0900 (JST)
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 <at> gmail.com | | vc-dir | dann <at> ics.uci.edu | | wgrep | mhayashi1120 <at> gmail.com | |--------+------------------------|
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.