help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Convert an existing keyboard macro to elisp code?


From: Yuri Khan
Subject: Re: Convert an existing keyboard macro to elisp code?
Date: Sat, 4 Aug 2012 00:00:40 +0700

On Fri, Aug 3, 2012 at 11:33 PM, PJ Weisberg
<pj@irregularexpressions.net> 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’t 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) — as
far as the macro recorder is concerned, you haven’t 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]