From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tak Kunihiro Newsgroups: gmane.emacs.bugs Subject: bug#16214: Consistency in dired-, occur-, and grep-mode Date: Sun, 22 Dec 2013 20:48:50 +0900 (JST) Message-ID: <20131222.204850.283027925.tkk@misasa.okayama-u.ac.jp> References: <20131221.224043.270400015.tkk@misasa.okayama-u.ac.jp> <87sitl51un.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1387713011 31504 80.91.229.3 (22 Dec 2013 11:50:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 22 Dec 2013 11:50:11 +0000 (UTC) Cc: josh@foxtail.org, tkk@misasa.okayama-u.ac.jp, roland@hack.frob.com To: 16214@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Dec 22 12:50:17 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VuhY1-0003dS-Ew for geb-bug-gnu-emacs@m.gmane.org; Sun, 22 Dec 2013 12:50:17 +0100 Original-Received: from localhost ([::1]:57421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VuhY1-0003ro-3v for geb-bug-gnu-emacs@m.gmane.org; Sun, 22 Dec 2013 06:50:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38341) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VuhXu-0003re-2n for bug-gnu-emacs@gnu.org; Sun, 22 Dec 2013 06:50:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VuhXn-0005it-Pz for bug-gnu-emacs@gnu.org; Sun, 22 Dec 2013 06:50:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48336) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VuhXn-0005hv-N8 for bug-gnu-emacs@gnu.org; Sun, 22 Dec 2013 06:50:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VuhXn-0008ET-7n for bug-gnu-emacs@gnu.org; Sun, 22 Dec 2013 06:50:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tak Kunihiro Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 22 Dec 2013 11:50:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16214 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16214-submit@debbugs.gnu.org id=B16214.138771295131557 (code B ref 16214); Sun, 22 Dec 2013 11:50:03 +0000 Original-Received: (at 16214) by debbugs.gnu.org; 22 Dec 2013 11:49:11 +0000 Original-Received: from localhost ([127.0.0.1]:34120 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuhWv-0008Cu-MX for submit@debbugs.gnu.org; Sun, 22 Dec 2013 06:49:11 -0500 Original-Received: from msmail2.misasa.okayama-u.ac.jp ([150.46.245.7]:51936 helo=msmail.misasa.okayama-u.ac.jp) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuhWq-0008CM-Vk for 16214@debbugs.gnu.org; Sun, 22 Dec 2013 06:49:07 -0500 Original-Received: from localhost (p8181-ipbfp304tottori.tottori.ocn.ne.jp [114.155.19.181]) by msmail.misasa.okayama-u.ac.jp (Postfix) with ESMTP id 35B57AF8094; Sun, 22 Dec 2013 20:48:57 +0900 (JST) In-Reply-To: <87sitl51un.fsf@mail.jurta.org> X-Mailer: Mew version 6.5 on Emacs 24.3 / Mule 6.0 (HANACHIRUSATO) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:82392 Archived-At: 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 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) | | "o" | | help | ? | | "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) | | | | occur | (occur-mode-goto-occurrence-this-window); *2 | | | | grep | (compile-goto-error-this-window); *3 | | | | 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 | | | | occur | *5 | | | | grep | *6 | | | |--------+----------------------------------------------+-----------+-----------| ; *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 | |--------+------------------------|