From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#8284: 24.0.50; M-q badly bound in diff-mode Date: Fri, 18 Mar 2011 15:19:19 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1300477038 15247 80.91.229.12 (18 Mar 2011 19:37:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 18 Mar 2011 19:37:18 +0000 (UTC) Cc: 8284@debbugs.gnu.org To: Julien Danjou Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 18 20:37:13 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q0fU1-0001P7-2W for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 Mar 2011 20:37:13 +0100 Original-Received: from localhost ([127.0.0.1]:35570 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q0fU0-0004yh-Cl for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 Mar 2011 15:37:12 -0400 Original-Received: from [140.186.70.92] (port=39556 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q0fTr-0004xh-S3 for bug-gnu-emacs@gnu.org; Fri, 18 Mar 2011 15:37:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q0fTq-0003T0-Cw for bug-gnu-emacs@gnu.org; Fri, 18 Mar 2011 15:37:03 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40365) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q0fTq-0003Sr-8N for bug-gnu-emacs@gnu.org; Fri, 18 Mar 2011 15:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Q0fDP-0007qa-1d; Fri, 18 Mar 2011 15:20:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Mar 2011 19:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8284 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8284-submit@debbugs.gnu.org id=B8284.130047597030117 (code B ref 8284); Fri, 18 Mar 2011 19:20:02 +0000 Original-Received: (at 8284) by debbugs.gnu.org; 18 Mar 2011 19:19:30 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q0fCr-0007pi-1h for submit@debbugs.gnu.org; Fri, 18 Mar 2011 15:19:29 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q0fCp-0007pV-CF for 8284@debbugs.gnu.org; Fri, 18 Mar 2011 15:19:27 -0400 Original-Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id p2IJJJKB002990; Fri, 18 Mar 2011 15:19:20 -0400 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id ACA26130010; Fri, 18 Mar 2011 15:19:19 -0400 (EDT) In-Reply-To: (Julien Danjou's message of "Fri, 18 Mar 2011 15:18:01 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3800=0 X-NAI-Spam-Version: 2.2.0.9286 : core <3800> : streams <609962> : uri <830195> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 18 Mar 2011 15:20:03 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:45156 Archived-At: > The `diff-mode' keymap `diff-mode-shared-map' inherit from > `special-mode-map' which defines M-q as `quit-window'. > This is *very* annoying when editing diff file build with > git-format-patch. I sometimes add some text/comments in it, and press > M-q to run `fill-paragraph'. But this calls `quit-window' and pisses > me off. > I don't know what is the best way to fix this, therefore I'm not > including any patch in this report, but would do it if possible. :-) When editing the buffer, diff-mode should not be considered as a special-mode. But I see that what you write is not quite what happens: M-q is not inherited from special-mode-map, it's that `q' is inherited from special-mode-map into diff-mode-shared-map which is bound to ESC, thus giving us a binding for M-q. So I think that diff-mode-map should shadow diff-mode-shared-map's q binding. I think the patch below does it. Stefan === modified file 'lisp/vc/diff-mode.el' --- lisp/vc/diff-mode.el 2011-03-14 03:40:18 +0000 +++ lisp/vc/diff-mode.el 2011-03-18 19:18:38 +0000 @@ -122,8 +122,7 @@ ("\C-m" . diff-goto-source) ([mouse-2] . diff-goto-source) ;; From XEmacs' diff-mode. - ;; Standard M-w is useful, so don't change M-W. - ;;("W" . widen) + ("W" . widen) ;;("." . diff-goto-source) ;display-buffer ;;("f" . diff-goto-source) ;find-file ("o" . diff-goto-source) ;other-window @@ -135,17 +134,21 @@ ;; Not useful if you have to metafy them. ;;(" " . scroll-up) ;;("\177" . scroll-down) - ;; Standard M-a is useful, so don't change M-A. - ;;("A" . diff-ediff-patch) - ;; Standard M-r is useful, so don't change M-r or M-R. - ;;("r" . diff-restrict-view) - ;;("R" . diff-reverse-direction) - ) + ("A" . diff-ediff-patch) + ("r" . diff-restrict-view) + ("R" . diff-reverse-direction)) "Basic keymap for `diff-mode', bound to various prefix keys." :inherit special-mode-map) (easy-mmode-defmap diff-mode-map - `(("\e" . ,diff-mode-shared-map) + `(("\e" . ,(let ((map (make-sparse-keymap))) + ;; We want to inherit most bindings from diff-mode-shared-map, + ;; but not all since they may hide useful M- global + ;; bindings when editing. + (set-keymap-parent map diff-mode-shared-map) + (dolist (key '("A" "r" "R" "g" "q" "W")) + (define-key map key nil)) + map)) ;; From compilation-minor-mode. ("\C-c\C-c" . diff-goto-source) ;; By analogy with the global C-x 4 a binding.