From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: Is there a plan to record kbd macro as elisp code? Date: Sun, 28 Oct 2007 09:50:42 -0400 Message-ID: References: <87y7doxmcw.fsf@jurta.org> Reply-To: rms@gnu.org NNTP-Posting-Host: lo.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: ger.gmane.org 1193579838 7379 80.91.229.12 (28 Oct 2007 13:57:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 28 Oct 2007 13:57:18 +0000 (UTC) Cc: yezonghui@gmail.com, monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 28 14:57:20 2007 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.50) id 1Im8dj-00070n-1C for ged-emacs-devel@m.gmane.org; Sun, 28 Oct 2007 14:57:19 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Im8da-0001Yw-4C for ged-emacs-devel@m.gmane.org; Sun, 28 Oct 2007 09:57:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Im8XO-0005We-4F for emacs-devel@gnu.org; Sun, 28 Oct 2007 09:50:46 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Im8XN-0005W0-Ac for emacs-devel@gnu.org; Sun, 28 Oct 2007 09:50:45 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Im8XN-0005Vn-2h for emacs-devel@gnu.org; Sun, 28 Oct 2007 09:50:45 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Im8XL-0008D9-PF for emacs-devel@gnu.org; Sun, 28 Oct 2007 09:50:44 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.60) (envelope-from ) id 1Im8XK-0000uT-TL; Sun, 28 Oct 2007 09:50:42 -0400 In-reply-to: <87y7doxmcw.fsf@jurta.org> (message from Juri Linkov on Sun, 28 Oct 2007 00:45:45 +0300) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) 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:81944 Archived-At: That's was exactly my first attempt when I tried to implement this feature. However, this approach doesn't work because a macro highly depends on its context, and will fail when repeating it in different buffers, modes, etc. We expect this conversion to use the keymaps that Emacs has when you do the conversion. That is a feature, not a bug. Also I added a new variable `last-kbd-macro-commands', and a new command `insert-last-kbd-macro-commands' to convert the recorded commands with their arguments to a Lisp function. The way you have written this, it looks like it cannot convert an existing keyboard macro. The user has to type the definition over again. That is a big drawback. Can you make this work by replaying the macro? At least then it would be possible to convert an existing macro. We want to do more simplification of the generated Lisp code; for instance, to combine multiple calls to self-insert-command into something more elegant.