From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: Question on remapping keys Date: Mon, 16 Jan 2006 09:46:10 -0800 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1137440291 19810 80.91.229.2 (16 Jan 2006 19:38:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 16 Jan 2006 19:38:11 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 16 20:38:07 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EyaAs-0003Gd-4q for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Jan 2006 20:37:54 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EyaDA-0006Se-Pu for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Jan 2006 14:40:16 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EyYTE-0003nj-Cc for help-gnu-emacs@gnu.org; Mon, 16 Jan 2006 12:48:44 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EyYTC-0003n4-KG for help-gnu-emacs@gnu.org; Mon, 16 Jan 2006 12:48:44 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EyYTC-0003n0-Gy for help-gnu-emacs@gnu.org; Mon, 16 Jan 2006 12:48:42 -0500 Original-Received: from [148.87.122.30] (helo=rgminet01.oracle.com) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EyYWk-0003kH-1w for help-gnu-emacs@gnu.org; Mon, 16 Jan 2006 12:52:22 -0500 Original-Received: from rgmsgw301.us.oracle.com (rgmsgw301.us.oracle.com [138.1.186.50]) by rgminet01.oracle.com (Switch-3.1.6/Switch-3.1.6) with ESMTP id k0GHkCkw005657; Mon, 16 Jan 2006 10:46:12 -0700 Original-Received: from rgmsgw301.us.oracle.com (localhost [127.0.0.1]) by rgmsgw301.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id k0GHkBjo006639; Mon, 16 Jan 2006 10:46:11 -0700 Original-Received: from dradamslap (dradams-lap.us.oracle.com [130.35.177.126]) by rgmsgw301.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with SMTP id k0GHkAJJ006626 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Mon, 16 Jan 2006 10:46:11 -0700 Original-To: =?us-ascii?Q?Johan_Bockgard?= , X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:32681 Archived-At: > (define-key map [remap `,from] to) `[remap ,from] Right. Thanks, Johan, but that doesn't completely solve the problem. The result of remapping is this for minibuffer-local-completion-map: (keymap ... (remap keymap (scroll-left . my-scroll-left) (scroll-right . my-scroll-right) (scroll-down . my-scroll-down) (scroll-up . my-scroll-up) (next-line . my-next-line) (previous-line . my-previous-line) (help-command . my-help) (self-insert-command . my-self-insert)) ...) This looks promising, but it seems to work only partially. For instance, (where-is-internal 'my-scroll-up (list minibuffer-local-completion-map)) returns ([remap scroll-up]), which looks good. `M-x' followed by `C-v' does invoke `my-scroll-up', but `M-x' followed by [next] (also bound to `scroll-up' in `global-map') does not invoke `my-scroll-up' - it invokes `next-history-element', just as in vanilla Emacs. IOW, apparently not all bindings of `scroll-up' got remapped. I'm looking for behavior similar to that of `substitute-key-definition': remap/substitute _all_ bindings. This is especially important since I apparently have no control over which single binding gets remapped - that is, only one binding of the command seems to be remapped, and I don't know how to pick which one. Similarly, (where-is-internal 'my-help (list minibuffer-local-completion-map)) returns ([remap help-command]). That suggests that `help-command' was remapped, but using `C-h' in the minibuffer does not invoke `my-help'. (Why?) If I use `substitute-key-definition', providing `global-map' as the OLDMAP arg, it works perfectly, but the performance is unacceptable. There must be some way to do something equivalent using command remapping (?).