From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: `special' keys in keyboard macros Date: Sat, 11 Oct 2003 01:37:51 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <16257.16532.727889.658851@tfkp07.physik.uni-erlangen.de> Reply-To: rms@gnu.org NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1065851012 20972 80.91.224.253 (11 Oct 2003 05:43:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 11 Oct 2003 05:43:32 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat Oct 11 07:43:30 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1A8CXK-0001XT-00 for ; Sat, 11 Oct 2003 07:43:30 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1A8CXK-0004We-00 for ; Sat, 11 Oct 2003 07:43:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1A8CX0-0007vC-FZ for emacs-devel@quimby.gnus.org; Sat, 11 Oct 2003 01:43:10 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1A8CUs-0007EN-Ob for emacs-devel@gnu.org; Sat, 11 Oct 2003 01:40:58 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1A8CUd-00079U-Qb for emacs-devel@gnu.org; Sat, 11 Oct 2003 01:40:56 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1A8CUd-00079E-FI for emacs-devel@gnu.org; Sat, 11 Oct 2003 01:40:43 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.24) id 1A8CRr-0001Hp-Kc; Sat, 11 Oct 2003 01:37:51 -0400 Original-To: Roland Winkler In-reply-to: <16257.16532.727889.658851@tfkp07.physik.uni-erlangen.de> (message from Roland Winkler on Mon, 6 Oct 2003 12:14:44 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:17033 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:17033 When emacs runs in its own X window [for short: "emacs (X)"] I get the keyboard macro ;; "emacs (X)" (fset 'foo [return left right up down insert delete backspace]) On the other hand "emacs -nw" gives me for the same key sequence ;; "emacs -nw" (fset 'bar "\C-m\C-[OD\C-[OC\C-[OA\C-[OB\C-[[2~\C-[[3~\C-?") The problem is: "emacs -nw" cannot make use of the keyboard macro foo and "emacs (X)" cannot make use of the macro bar either. The cause of this problem is obvious; what's amazing is that I never thought of it until you pointed it out. It seems that a solution might be to do the processing through function-key-map before recording keys in the keyboard macro. I looked at the code, and this is not trivial, so I won't try to write it now. I think it would take a bit of hard debugging to make this work right in all cases. Basically, you'd need to make read_key_sequence remove, from the keyboard macro being defined, the characters it reads, and then record the translated versions of them. To be entirely correct, the characters you record should not have been translated through key-translation-map, only through function-key-map.