From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: M-g in dired Date: Sat, 15 Oct 2005 14:27:27 +0300 Organization: JURTA Message-ID: <873bnf36mr.fsf@jurta.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1129377605 23342 80.91.229.2 (15 Oct 2005 12:00:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 15 Oct 2005 12:00:05 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 15 13:59:56 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EQkh2-0003DH-1I for ged-emacs-devel@m.gmane.org; Sat, 15 Oct 2005 13:59:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EQkh1-0003DB-3d for ged-emacs-devel@m.gmane.org; Sat, 15 Oct 2005 07:59:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EQkdS-0002Xf-BQ for emacs-devel@gnu.org; Sat, 15 Oct 2005 07:55:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EQkdP-0002XJ-Gr for emacs-devel@gnu.org; Sat, 15 Oct 2005 07:55:33 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EQkdO-0002XB-Mf for emacs-devel@gnu.org; Sat, 15 Oct 2005 07:55:30 -0400 Original-Received: from [194.126.101.111] (helo=mail.neti.ee) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EQkdO-0003v6-SB for emacs-devel@gnu.org; Sat, 15 Oct 2005 07:55:31 -0400 Original-Received: from mail.neti.ee (80-235-32-180-dsl.mus.estpak.ee [80.235.32.180]) by Relayhost1.neti.ee (Postfix) with ESMTP id 2504E16D1 for ; Sat, 15 Oct 2005 14:55:39 +0300 (EEST) Original-To: emacs-devel@gnu.org User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-Virus-Scanned: by amavisd-new-2.2.1 (20041222) (Debian) at neti.ee X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:44062 Archived-At: `M-g M-n' is a nice key binding for `next-error' (easy to type and mnemonic), but has one problem. Just imagine a quite likely scenario: the user switches to the dired buffer, invokes `compile' or `grep', and types `M-g M-n' to go to the first error displayed in the output buffer in another window. Now instead of going to the first error, the message "End of history; no default available" is displayed in the echo area. That's because `M-g' is bound to `dired-goto-file' in the dired buffer, which activates the minibuffer, and the second key `M-n' typed by the user is bound in the minibuffer to `next-history-element' (which signals an error for no default value). It seems `M-g' in dired buffers should be rebound for `dired-goto-file' to a key sequence with the `M-g' prefix. I see at least two variants: 1. Rebind `dired-goto-file' to `M-g g' (and `M-g M-g'). The global binding for `M-g g' is `goto-line' which doesn't seem to be useful in dired buffers. So dired buffers could have a local binding `M-g g' for `dired-goto-file'. 2. Rebind `dired-goto-file' to `M-g f' (and `M-g M-f'). This key sequence could serve as a global key binding. Typing it in any buffer could create a dired buffer and move point to the file specified in the minibuffer (with the default value being the current buffer's file name). It is not unreasonable to have both bindings. BTW, there is a bug related to key suggestions: `M-x next-error RET' typed in a dired buffer suggests the key binding `M-g n' even though `M-g' is not a prefix key in dired buffers. Sometimes it may suggest `C-x `' when `where-is-internal' returns the first keybindings. Since it's not possible to control which keybinding `where-is-internal' returns, to reproduce this bug `C-x `' should be unbound globally, e.g. by (define-key ctl-x-map "`" nil). After that (key-description (where-is-internal 'next-error overriding-local-map t)) evaluates in a dired buffer to "M-g n", but currently it is not possible to use this key in dired buffers. -- Juri Linkov http://www.jurta.org/emacs/