[gsharp-devel] Initial thoughts
Robert STRANDH
strandh at labri.fr
Tue Feb 24 06:01:39 UTC 2004
Robert STRANDH writes:
>
> Christophe Rhodes writes:
> >
> > Whether this keyboard macro facility wants to
> > record gestures (keystrokes) or commands, I don't know -- does anyone
> > know what emacs does? Probably both in various circumstances. :-)
>
> I don't think it matters really. The only situation where one could
> see the difference would be if keyboard bindings change between the
> definition and the invocation of a keyboard macro.
So, I did it by recording keystrokes, and now I know why I should
probably have done it the other way.
The problem is that, in the current implementation, the keystrokes
that were used to invoke end-kbd-macro are on the list of recorded
keys when end-kbd-macro is executed, and must be removed. But
end-kbd-macro should not have to know how it was invoked. A solution
that consists of finding the last keystrokes on the list of recorded
keys that invoke end-kbd-macro does not seem like a good idea (what if
it were invoked by using the command-line?).
A better solution seems to be to record the commands that were
invoked. The last command on the list is always end-kbd-macro itself,
so it can be safely removed. This solution also makes it easier to
record commands invoked from the command line (which currently is not
done).
This improved solution is still tricky in the presence of things like
numeric arguments (whenever they become implemented). Probably, the
recording list has to contain thunks that encapsulate numeric
arguments and the way the command was invoked. Executing the macro
consists of funcall-ing each thunk.
--
Robert Strandh
---------------------------------------------------------------------
Greenspun's Tenth Rule of Programming: any sufficiently complicated C
or Fortran program contains an ad hoc informally-specified bug-ridden
slow implementation of half of Common Lisp.
---------------------------------------------------------------------
More information about the gsharp-devel
mailing list