From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: substitute-key-definition vs. define-key MAP [remap ...] Date: Fri, 23 Jul 2010 11:26:47 +0200 Message-ID: References: <871vb517a6.fsf@mithlond.arda> <87aapiyhzo.fsf@uwakimon.sk.tsukuba.ac.jp> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1279877232 14818 80.91.229.12 (23 Jul 2010 09:27:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 23 Jul 2010 09:27:12 +0000 (UTC) Cc: Teemu Likonen , emacs-devel@gnu.org To: "Stephen J. Turnbull" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 23 11:27:11 2010 Return-path: Envelope-to: ged-emacs-devel@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 1OcEX8-0000aJ-FZ for ged-emacs-devel@m.gmane.org; Fri, 23 Jul 2010 11:27:10 +0200 Original-Received: from localhost ([127.0.0.1]:48747 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OcEX3-000715-Tm for ged-emacs-devel@m.gmane.org; Fri, 23 Jul 2010 05:27:05 -0400 Original-Received: from [140.186.70.92] (port=35410 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OcEWr-0006z2-VY for emacs-devel@gnu.org; Fri, 23 Jul 2010 05:26:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OcEWq-0006ft-L6 for emacs-devel@gnu.org; Fri, 23 Jul 2010 05:26:53 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:39546) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OcEWq-0006fb-HX for emacs-devel@gnu.org; Fri, 23 Jul 2010 05:26:52 -0400 Original-Received: from ceviche.home (vpn-132-204-232-40.acd.umontreal.ca [132.204.232.40]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id o6N9QmNT010767; Fri, 23 Jul 2010 05:26:49 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 5B8F7660D2; Fri, 23 Jul 2010 11:26:47 +0200 (CEST) In-Reply-To: <87aapiyhzo.fsf@uwakimon.sk.tsukuba.ac.jp> (Stephen J. Turnbull's message of "Fri, 23 Jul 2010 12:50:03 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3584=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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:127686 Archived-At: > If I understand you correctly, that won't get into XEmacs any time > soon. Do you really mean that `define-key' is allowed to effectively > change the command binding of a symbol globally, so that its function > definition is ignored in the context of interpreting keystrokes? Ie, > `define-key' now turns Emacs into what is effectively a LISP-3? I don't know what "ignored in the context of interpreting keystrokes" means, nor what LISP-3 means. The `remap' thingy operates at the level of `key-binding'. I.e. after the command loop reads a key-sequence, it looks it up in the keymaps to turn the key-sequence into a command, and then it looks this up in the `remap' sub-keymap(s) to see if it got remapped. So if you want to bind the original command to a key, you have to trick the remapping by using another command name, e.g.: (defalias 'new-name-for-old-command 'old-remapped-command) (define-key MAP [KEYS] 'new-name-for-old-command) since the remapping will apply to `old-remapped-command' but not to `new-name-for-old-command'. There are other ways, of course, such as: (define-key MAP [KEYS] (lambda () (interactive) (call-interactively 'old-remapped-command))) -- Stefan