From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: Convert an existing keyboard macro to elisp code? Date: Sat, 4 Aug 2012 00:00:40 +0700 Message-ID: References: <87mx2cxb7x.fsf@googlemail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1344013261 32331 80.91.229.3 (3 Aug 2012 17:01:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 3 Aug 2012 17:01:01 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: PJ Weisberg Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 03 19:01:01 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SxLFA-0007cE-0d for geh-help-gnu-emacs@m.gmane.org; Fri, 03 Aug 2012 19:00:56 +0200 Original-Received: from localhost ([::1]:41804 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxLF8-00035e-WA for geh-help-gnu-emacs@m.gmane.org; Fri, 03 Aug 2012 13:00:54 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxLF0-00035N-NX for help-gnu-emacs@gnu.org; Fri, 03 Aug 2012 13:00:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SxLEw-0007eK-A0 for help-gnu-emacs@gnu.org; Fri, 03 Aug 2012 13:00:46 -0400 Original-Received: from mail-vc0-f169.google.com ([209.85.220.169]:59823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxLEw-0007de-5Q for help-gnu-emacs@gnu.org; Fri, 03 Aug 2012 13:00:42 -0400 Original-Received: by vcbfl10 with SMTP id fl10so1017731vcb.0 for ; Fri, 03 Aug 2012 10:00:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=tb0M/8XOV3leUhfTgVz+T8L0gnNxtWGlT/fB+2jtJH8=; b=Ukl41CxdTNrTv3qOD2U9CBuvtqsbrO0mFfgjXHt/44ZXFv/8t5LPQ4ZuUIpClTcx0l xBqfgm1oBOqo5ESpb325nCc0il4B/t0DX26AHgNLuYvmtIBJ09l7wLgkp1pyylj7lGcG zD4VZIK7ptaqVHotZ/7tsUgqpRmefdp3FxI8H0QmQTpki6laSU5jdSBKbF9lgAFZxTt9 FOkrqJnkWNf9PQJwWz/vmxgued4uY3NxuF13jjRfNjxgvKDnBhigi1Pw8JVdLCsCU+Dq unl84HpMCbx+S3i/okWTdYQm0Qn4iKSu7hOiqLMnEK+mW9CzAJVPDBer5iM0e1K96pGc N67Q== Original-Received: by 10.52.93.98 with SMTP id ct2mr1601763vdb.97.1344013240883; Fri, 03 Aug 2012 10:00:40 -0700 (PDT) Original-Received: by 10.220.108.78 with HTTP; Fri, 3 Aug 2012 10:00:40 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: JHgnL_0c-sfxvM_RINXpY9ZxbWk X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.220.169 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:86184 Archived-At: On Fri, Aug 3, 2012 at 11:33 PM, PJ Weisberg wrote: > If it were just a matter of reading the key sequence and mapping it to > functions it wouldn't be too bad, but the more I think about this, the > more it seems like a rat hole. How would you translate > > (fset 'my-macro > [?\M-x ?m ?a ?g tab ?i ?t tab ?s ?t tab ?t tab return ?m ?a tab return= ]) Additionally, a macro may switch the currently active mode, e.g. by visiting a new file or switching windows/frames/buffers. The translating code won=92t see it without actually executing the macro. No, this facility has to be in the core to be any effective. And, it works that way in (gasp!) Word and Excel, and I can say it is not at all always what is wanted. E.g. a dumb purely key-based macro can initiate a command that wants further user input and finish, leaving it up to the user to deal with that interactively. A smart macro, however, is incomplete until the user completes the additional input (e.g. by clicking OK in an Excel find-and-replace dialog) =97 as far as the macro recorder is concerned, you haven=92t even started doing anything yet; if your intent was to open a dialog with a few fields pre-populated with some specific values, tough luck.