From unknown Sat Aug 09 13:14:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6632: 23.2.50; dired-mode should use [remap ...] instead of hard-coded overriding of global key bindings Resent-From: Teemu Likonen Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Jul 2010 16:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 6632 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 6632@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.127912320724236 (code B ref -1); Wed, 14 Jul 2010 16:01:01 +0000 Received: (at submit) by debbugs.gnu.org; 14 Jul 2010 16:00:07 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZ4NS-0006IL-De for submit@debbugs.gnu.org; Wed, 14 Jul 2010 12:00:06 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZ4NP-0006F6-D7 for submit@debbugs.gnu.org; Wed, 14 Jul 2010 12:00:04 -0400 Received: from lists.gnu.org ([199.232.76.165]:45273) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OZ4NX-0006Op-CQ for submit@debbugs.gnu.org; Wed, 14 Jul 2010 12:00:11 -0400 Received: from [140.186.70.92] (port=54349 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OZ4NV-0002HK-Ia for bug-gnu-emacs@gnu.org; Wed, 14 Jul 2010 12:00:10 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, T_TVD_MIME_NO_HEADERS autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OZ4NT-0008Mi-Ur for bug-gnu-emacs@gnu.org; Wed, 14 Jul 2010 12:00:09 -0400 Received: from mta-out.inet.fi ([195.156.147.13]:33098 helo=kirsi2.inet.fi) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZ4NT-00081w-Gi for bug-gnu-emacs@gnu.org; Wed, 14 Jul 2010 12:00:07 -0400 Received: from mithlond.arda (84.251.132.215) by kirsi2.inet.fi (8.5.122) id 4C33307D0037BBC0 for bug-gnu-emacs@gnu.org; Wed, 14 Jul 2010 18:58:28 +0300 Received: from dtw by mithlond.arda with local (Exim 4.69) (envelope-from ) id 1OZ4Ld-0004gk-5M for bug-gnu-emacs@gnu.org; Wed, 14 Jul 2010 18:58:13 +0300 From: Teemu Likonen Date: Wed, 14 Jul 2010 18:58:13 +0300 Message-ID: <87eif6ukbu.fsf@mithlond.arda> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.1 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.3 (-----) --=-=-= dired-mode uses hard-coding when it rebinds some global key bindings. For example, there is the following line in dired.el file: (define-key map "\C-n" 'dired-next-line) Therefore it overrides the global C-n key, whatever its command is in user's keymap. The command should be bound like this: (define-key map [remap next-line] 'dired-next-line) Using [remap ...] is preferred because it makes it possible for user to redefine the global keymap they way she wishes and keys will still automatically get their mode-specific behaviour. The attached patch fixes this for dired-mode. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=dired-mode-remap.diff diff --git a/lisp/dired.el b/lisp/dired.el index c3d1435..0e5cc22 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -1380,10 +1380,8 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." (define-key map ">" 'dired-next-dirline) (define-key map "^" 'dired-up-directory) (define-key map " " 'dired-next-line) - (define-key map "\C-n" 'dired-next-line) - (define-key map "\C-p" 'dired-previous-line) - (define-key map [down] 'dired-next-line) - (define-key map [up] 'dired-previous-line) + (define-key map [remap next-line] 'dired-next-line) + (define-key map [remap previous-line] 'dired-previous-line) ;; hiding (define-key map "$" 'dired-hide-subdir) (define-key map "\M-$" 'dired-hide-all) @@ -1393,7 +1391,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." (define-key map (kbd "M-s f C-s") 'dired-isearch-filenames) (define-key map (kbd "M-s f M-C-s") 'dired-isearch-filenames-regexp) ;; misc - (define-key map "\C-x\C-q" 'dired-toggle-read-only) + (define-key map [remap toggle-read-only] 'dired-toggle-read-only) (define-key map "?" 'dired-summary) (define-key map "\177" 'dired-unmark-backward) (define-key map [remap undo] 'dired-undo) --=-=-=-- From unknown Sat Aug 09 13:14:19 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Teemu Likonen Subject: bug#6632: closed (Re: bug#6632: 23.2.50; dired-mode should use [remap ...] instead of hard-coded overriding of global key bindings) Message-ID: References: <87eif6ukbu.fsf@mithlond.arda> X-Gnu-PR-Message: they-closed 6632 X-Gnu-PR-Package: emacs Reply-To: 6632@debbugs.gnu.org Date: Thu, 22 Jul 2010 11:57:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1279799822-27847-1" This is a multi-part message in MIME format... ------------=_1279799822-27847-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #6632: 23.2.50; dired-mode should use [remap ...] instead of hard-coded ove= rriding of global key bindings which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 6632@debbugs.gnu.org. --=20 6632: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D6632 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1279799822-27847-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 6632-done) by debbugs.gnu.org; 22 Jul 2010 11:56:55 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ObuOU-0007Ex-T9 for submit@debbugs.gnu.org; Thu, 22 Jul 2010 07:56:55 -0400 Received: from mail-bw0-f44.google.com ([209.85.214.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ObuOS-0007Eq-Rv for 6632-done@debbugs.gnu.org; Thu, 22 Jul 2010 07:56:53 -0400 Received: by bwz7 with SMTP id 7so870354bwz.3 for <6632-done@debbugs.gnu.org>; Thu, 22 Jul 2010 04:57:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=FXgJfaWW8RytmHi1hk+T4Z2EWKEch3fpAfAGqzwszsk=; b=XxRHZx6op7PzNtz9TLkecf9j6PaFUn7KU6FeYSywmG+39RUonYQ5sLaoxz6h9tmXj5 ZXMn3zDoEJ0TCrWt1F6UowA9S2tqKvP7N+5PyaecfalKZLtdKiWImjik7I2JNkKu7JOJ Go5e8MHKPl6n0MCfZ0OPTbp51jjaCEmuXCFiw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=GfDd4e7oO6AzN1pMf1mkKjx0jVkgyrbO8iokzW3XBpSahj4KtITeCrTh5hUOz3fYRs Z+hfarVsM1+6XF5ZyNMnufvBCRYF08gcS+aIxL8K40jhhV2Snzk6BRvXCRqPxKZVvHYw yrVdFNJo9nr896BdUIV5ooaekreUr9JG12+SQ= Received: by 10.204.140.219 with SMTP id j27mr1273146bku.153.1279799840399; Thu, 22 Jul 2010 04:57:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.180.136 with HTTP; Thu, 22 Jul 2010 04:57:00 -0700 (PDT) In-Reply-To: <87eif6ukbu.fsf@mithlond.arda> References: <87eif6ukbu.fsf@mithlond.arda> From: Juanma Barranquero Date: Thu, 22 Jul 2010 13:57:00 +0200 Message-ID: Subject: Re: bug#6632: 23.2.50; dired-mode should use [remap ...] instead of hard-coded overriding of global key bindings To: Teemu Likonen Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 6632-done Cc: 6632-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) On Wed, Jul 14, 2010 at 17:58, Teemu Likonen wrote: > The attached patch fixes this for dired-mode. Committed, thanks. =C2=A0 =C2=A0 Juanma ------------=_1279799822-27847-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 14 Jul 2010 16:00:07 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZ4NS-0006IL-De for submit@debbugs.gnu.org; Wed, 14 Jul 2010 12:00:06 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZ4NP-0006F6-D7 for submit@debbugs.gnu.org; Wed, 14 Jul 2010 12:00:04 -0400 Received: from lists.gnu.org ([199.232.76.165]:45273) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OZ4NX-0006Op-CQ for submit@debbugs.gnu.org; Wed, 14 Jul 2010 12:00:11 -0400 Received: from [140.186.70.92] (port=54349 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OZ4NV-0002HK-Ia for bug-gnu-emacs@gnu.org; Wed, 14 Jul 2010 12:00:10 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, T_TVD_MIME_NO_HEADERS autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OZ4NT-0008Mi-Ur for bug-gnu-emacs@gnu.org; Wed, 14 Jul 2010 12:00:09 -0400 Received: from mta-out.inet.fi ([195.156.147.13]:33098 helo=kirsi2.inet.fi) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZ4NT-00081w-Gi for bug-gnu-emacs@gnu.org; Wed, 14 Jul 2010 12:00:07 -0400 Received: from mithlond.arda (84.251.132.215) by kirsi2.inet.fi (8.5.122) id 4C33307D0037BBC0 for bug-gnu-emacs@gnu.org; Wed, 14 Jul 2010 18:58:28 +0300 Received: from dtw by mithlond.arda with local (Exim 4.69) (envelope-from ) id 1OZ4Ld-0004gk-5M for bug-gnu-emacs@gnu.org; Wed, 14 Jul 2010 18:58:13 +0300 From: Teemu Likonen To: bug-gnu-emacs@gnu.org Subject: 23.2.50; dired-mode should use [remap ...] instead of hard-coded overriding of global key bindings Date: Wed, 14 Jul 2010 18:58:13 +0300 Message-ID: <87eif6ukbu.fsf@mithlond.arda> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.3 (-----) --=-=-= dired-mode uses hard-coding when it rebinds some global key bindings. For example, there is the following line in dired.el file: (define-key map "\C-n" 'dired-next-line) Therefore it overrides the global C-n key, whatever its command is in user's keymap. The command should be bound like this: (define-key map [remap next-line] 'dired-next-line) Using [remap ...] is preferred because it makes it possible for user to redefine the global keymap they way she wishes and keys will still automatically get their mode-specific behaviour. The attached patch fixes this for dired-mode. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=dired-mode-remap.diff diff --git a/lisp/dired.el b/lisp/dired.el index c3d1435..0e5cc22 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -1380,10 +1380,8 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." (define-key map ">" 'dired-next-dirline) (define-key map "^" 'dired-up-directory) (define-key map " " 'dired-next-line) - (define-key map "\C-n" 'dired-next-line) - (define-key map "\C-p" 'dired-previous-line) - (define-key map [down] 'dired-next-line) - (define-key map [up] 'dired-previous-line) + (define-key map [remap next-line] 'dired-next-line) + (define-key map [remap previous-line] 'dired-previous-line) ;; hiding (define-key map "$" 'dired-hide-subdir) (define-key map "\M-$" 'dired-hide-all) @@ -1393,7 +1391,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." (define-key map (kbd "M-s f C-s") 'dired-isearch-filenames) (define-key map (kbd "M-s f M-C-s") 'dired-isearch-filenames-regexp) ;; misc - (define-key map "\C-x\C-q" 'dired-toggle-read-only) + (define-key map [remap toggle-read-only] 'dired-toggle-read-only) (define-key map "?" 'dired-summary) (define-key map "\177" 'dired-unmark-backward) (define-key map [remap undo] 'dired-undo) --=-=-=-- ------------=_1279799822-27847-1--