20140921 basic macros

A basic implementation of the essentials of replayable macros in emacs.  Macro counters, naming, saving, etc are unimplemented yet.  Those features aren't useful, however without the basics of recording and playback.  Any comments are appreciated.
To allow focus to take effect in case there are any behavior changes I
didn't take into account.  It may not be needed.

On Sun, Sep 21, 2014 at 4:07 AM, Mihai Bazon <notifications@github.com>
wrote:

> In src/js/ymacs.js:
>
> > +    P.stepMacro = function() {
> > +        if (this.__macro_step >= this.__running_macro.length) {
> > +            this.__macro_times--;
> > +            this.__macro_step = 0;
> > +        }
> > +        if (this.__macro_times == 0 || this.__error_thrown) {
> > +            this.__macro_times = 0;
> > +            this.__macro_step = 0;
> > +            this.__running_macro = null;
> > +            return;
> > +        }
> > +        var ev = this.__running_macro[this.__macro_step];
> > +        this.processKeyEvent(ev, ev.wasKeypress);
> > +        this.__macro_step++;
> > +        var self = this;
> > +        setTimeout(function() { self.stepMacro(); }, 0);
>
> Just wondering, what's the reason for the setTimeout here?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/mishoo/ymacs/pull/8/files#r17824601>.
>