From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: Is there a plan to record kbd macro as elisp code? Date: Sat, 27 Oct 2007 23:22:22 +0200 Message-ID: <87wst8uub5.fsf@kfs-lx.testafd.dk> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1193520160 4886 80.91.229.12 (27 Oct 2007 21:22:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 27 Oct 2007 21:22:40 +0000 (UTC) Cc: yzhh , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 27 23:22:41 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 1Ilt78-0000jz-H6 for ged-emacs-devel@m.gmane.org; Sat, 27 Oct 2007 23:22:38 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ilt6z-0003Ot-IY for ged-emacs-devel@m.gmane.org; Sat, 27 Oct 2007 17:22:29 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ilt6w-0003Oe-Il for emacs-devel@gnu.org; Sat, 27 Oct 2007 17:22:26 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ilt6v-0003OS-4k for emacs-devel@gnu.org; Sat, 27 Oct 2007 17:22:25 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ilt6v-0003OP-06 for emacs-devel@gnu.org; Sat, 27 Oct 2007 17:22:25 -0400 Original-Received: from mail-relay.sonofon.dk ([212.88.64.25]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1Ilt6u-0003mb-HW for emacs-devel@gnu.org; Sat, 27 Oct 2007 17:22:24 -0400 Original-Received: (qmail 6018 invoked from network); 27 Oct 2007 21:22:23 -0000 Original-Received: from unknown (HELO kfs-lx.testafd.dk.cua.dk) (213.83.150.2) by 0 with SMTP; 27 Oct 2007 21:22:23 -0000 In-Reply-To: (Stefan Monnier's message of "Sat\, 27 Oct 2007 16\:04\:57 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.6-4.9 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:81884 Archived-At: Stefan Monnier writes: >> Thank you for your appreciation. But my modification is in the C code of >> emacs, because 'execute-command' and 'call-interactively' are in C code. >> And I don't think my dirty code would be a valid patch for the emacs >> developers. > > I think what was expected was to first record a keyboard macro and later to > turn that into elisp code. Another approach is to use a pre-command-hook to > record the value of `this-command' for each command run. Which reminds me that there is a big difference between replaying a keyboard macro and running the corresponding functions as a single command: - the pre-command-hook and post-command-hook are run for each key in the keyboard macro, but only once for the single command. This doesn't mean that the elisp code cannot be equivalent to the keyboard macro, but it may be much harder to do right. E.g. if you use modes like delete-selection-mode or cua-mode which do major work in the hooks. -- Kim F. Storm http://www.cua.dk