From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: where-is-internal question Date: Tue, 6 Sep 2005 17:54:55 -0700 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1126055925 8358 80.91.229.2 (7 Sep 2005 01:18:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 7 Sep 2005 01:18:45 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 07 03:18:43 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1ECoZW-0008O8-8B for ged-emacs-devel@m.gmane.org; Wed, 07 Sep 2005 03:17:54 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ECoe1-0005eJ-QY for ged-emacs-devel@m.gmane.org; Tue, 06 Sep 2005 21:22:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ECock-0005WM-2d for emacs-devel@gnu.org; Tue, 06 Sep 2005 21:21:14 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ECocS-0005RU-8F for emacs-devel@gnu.org; Tue, 06 Sep 2005 21:21:02 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ECoc8-0005Hn-Ms for emacs-devel@gnu.org; Tue, 06 Sep 2005 21:20:36 -0400 Original-Received: from [141.146.126.231] (helo=agminet04.oracle.com) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1ECoHS-0004Tg-8z for emacs-devel@gnu.org; Tue, 06 Sep 2005 20:59:14 -0400 Original-Received: from rgmsgw301.us.oracle.com (rgmsgw301.us.oracle.com [138.1.186.50]) by agminet04.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id j870sxJ0031637 for ; Tue, 6 Sep 2005 19:55:00 -0500 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 j870swlK009955 for ; Tue, 6 Sep 2005 18:54:58 -0600 Original-Received: from dradamslap (dhcp-amer-whq-csvpn-gw3-141-144-81-65.vpn.oracle.com [141.144.81.65]) by rgmsgw301.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with SMTP id j870svFB009929 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Tue, 6 Sep 2005 18:54:58 -0600 Original-To: "Emacs-Devel" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 Importance: Normal X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE 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:42683 Archived-At: I haven't looked into this in detail - forgive my incomplete understanding. I'm looking for help on where-is-internal - as regards command remapping (I guess). In previous Emacs versions, I could do this, to bind stuff that is bound to self-insert-command in the global map: (dolist (key (where-is-internal 'self-insert-command global-map)) (define-key my-map key 'my-command)) Now, however, it looks like I need to do something like the following. Let me know if I'm missing something, and there is a simpler way. (dolist (key (or (condition-case nil (where-is-internal 'self-insert-command global-map nil nil t) (wrong-number-of-arguments nil)) (where-is-internal 'self-insert-command global-map))) ; use old version (define-key my-map key 'my-command)) IIUC (probably not), the 5th arg to where-is-internal is needed here, because of some remapping done to self-insert-command (?). The NEWS file says this, for Emacs 22.1: `where-is-internal' now returns nil for a remapped command (e.g. `kill-line', when `my-mode' is enabled), and the actual key binding for the command it is remapped to (e.g. C-k for my-kill-line). It also has a new optional fifth argument, NO-REMAP, which inhibits remapping if non-nil (e.g. it returns "C-k" for `kill-line', and "" for `my-kill-line') I guess that explains what's going on here, but I don't quite follow it. I also searched NEWS for info on self-insert, but I didn't see anything that I understood as being related. All I know is that if I don't use a non-nil 5th argument, I don't get the bindings I'm after; if I do use it, that works. I'm guessing that self-insert-command must be remapped, and that is why I need to use a non-nil 5th arg - to prevent where-is-internal from returning nil for each of the (remapped) self-insert-command bindings. Could someone please clear up for me just what is going on here? In ignorance, I'm thinking that the new 5th arg should be defined the other way 'round: nil should do what t does now, to give better backward compatibility. That way (I think), I would be able to do just (where-is-internal 'self-insert-command global-map) in all Emacs versions. Please let me know what I'm missing (>= 80%, I'm sure). Thanks.