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: Sat, 21 Dec 2013 22:40:43 +0900 (JST) Message-ID: <20131221.224043.270400015.tkk@misasa.okayama-u.ac.jp> 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 1387650074 24400 80.91.229.3 (21 Dec 2013 18:21:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 Dec 2013 18:21:14 +0000 (UTC) Cc: tkk@misasa.okayama-u.ac.jp, Roland McGrath To: 16214@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Dec 21 19:21:20 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 1VuRAt-0002TF-RV for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Dec 2013 19:21:20 +0100 Original-Received: from localhost ([::1]:55149 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VuRAt-0006NF-DG for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Dec 2013 13:21:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VuRAl-0006Mt-3g for bug-gnu-emacs@gnu.org; Sat, 21 Dec 2013 13:21:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VuRAe-0007DR-Sd for bug-gnu-emacs@gnu.org; Sat, 21 Dec 2013 13:21:11 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47686) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VuRAe-0007DM-O0 for bug-gnu-emacs@gnu.org; Sat, 21 Dec 2013 13:21:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VuRAe-0007OO-2Y for bug-gnu-emacs@gnu.org; Sat, 21 Dec 2013 13:21:04 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tak Kunihiro Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Dec 2013 18:21:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16214 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.138765003928345 (code B ref -1); Sat, 21 Dec 2013 18:21:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Dec 2013 18:20:39 +0000 Original-Received: from localhost ([127.0.0.1]:33470 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuRAD-0007N1-TE for submit@debbugs.gnu.org; Sat, 21 Dec 2013 13:20:39 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:52852) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuMno-0006xI-VB for submit@debbugs.gnu.org; Sat, 21 Dec 2013 08:41:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VuMni-0007Ls-TK for submit@debbugs.gnu.org; Sat, 21 Dec 2013 08:41:12 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:60969) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VuMni-0007Lo-QE for submit@debbugs.gnu.org; Sat, 21 Dec 2013 08:41:06 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54560) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VuMnd-0007zi-3J for bug-gnu-emacs@gnu.org; Sat, 21 Dec 2013 08:41:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VuMnV-0007Kt-WF for bug-gnu-emacs@gnu.org; Sat, 21 Dec 2013 08:41:01 -0500 Original-Received: from msmail2.misasa.okayama-u.ac.jp ([150.46.245.7]:50918 helo=msmail.misasa.okayama-u.ac.jp) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VuMnV-0007Kc-DN for bug-gnu-emacs@gnu.org; Sat, 21 Dec 2013 08:40:53 -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 1F4A7AF8094; Sat, 21 Dec 2013 22:40:47 +0900 (JST) X-Mailer: Mew version 6.5 on Emacs 24.3 / Mule 6.0 (HANACHIRUSATO) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Sat, 21 Dec 2013 13:20:33 -0500 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:82343 Archived-At: 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))) |-------+----------------------------------------------| | 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))) |-------+-----| | 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)))