From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: yzhh Newsgroups: gmane.emacs.devel Subject: Re: recording-elisp.el - try recording commands as elisp code Date: Sat, 03 Nov 2007 12:23:54 +0800 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: ger.gmane.org 1194063870 20908 80.91.229.12 (3 Nov 2007 04:24:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 3 Nov 2007 04:24:30 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 03 05:24:34 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 1IoAYi-00015D-UI for ged-emacs-devel@m.gmane.org; Sat, 03 Nov 2007 05:24:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IoAYY-0003We-H4 for ged-emacs-devel@m.gmane.org; Sat, 03 Nov 2007 00:24:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IoAYU-0003UF-Fy for emacs-devel@gnu.org; Sat, 03 Nov 2007 00:24:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IoAYT-0003Sq-05 for emacs-devel@gnu.org; Sat, 03 Nov 2007 00:24:18 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IoAYS-0003Sj-ST for emacs-devel@gnu.org; Sat, 03 Nov 2007 00:24:16 -0400 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IoAYS-0001GW-9l for emacs-devel@gnu.org; Sat, 03 Nov 2007 00:24:16 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1IoAYI-0007XL-GD for emacs-devel@gnu.org; Sat, 03 Nov 2007 04:24:06 +0000 Original-Received: from 211.90.238.185 ([211.90.238.185]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 03 Nov 2007 04:24:06 +0000 Original-Received: from yezonghui by 211.90.238.185 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 03 Nov 2007 04:24:06 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 32 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 211.90.238.185 User-Agent: KNode/0.10.5 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:82405 Archived-At: Stefan Monnier wrote: > I suspect that this kind of problem is going to re-appear in various > other forms for other commands. I think the right way to do it is to > provide "hooks" in record-lisp which isearch can then use to explain > what it does. E.g. record-lisp could check the last command's > `record-lisp-cleanup-function' symbol and if set call it to clean up the > last few commands. Isearch could then set this property on > `isearch-exit'. Well, to tell you the truth, I have no idea what I'm > talking about, so the suggestion probably isn't workable as is, but > hopefully it gives you an idea of how to cleanly interface the > two packages. I saw your post later than I took actions. Your suggestion is similar to what I did: I've reconstructed the code so that the output procedure uses an alist to lookup a "special treatment" function for certain commands. The function takes the original recorded commands and already-have output command list, and returns a modified output. I implemented 3 such functions: one for simply ignoring a command, one for cumulating consecutive self-insert-command, and another for isearch-exit. More to come. In this way I think we can put some special treatment of commonly used commands here. And other not-very-common commands can be taken care of by the corresponding package developer or the user. I'm I right? -- regards, yzhh