[comp.emacs] Keyboard macros Turing-equivalent

barmar@think.COM (Barry Margolin) (02/17/89)

In article <36077@bbn.COM> mesard@BBN.COM (Wayne Mesard) writes:
>[[Hypothesis of the day: It is possible to build an arbitrarily complex
>Turing machine using Emacs keyboard macros :-) ]]
>
>[[Followups refuting the previous sentence (after all its got a
>net.insurance.policy (i.e. a smiley)), or showing a way to do the macro
>in only six keystrokes to /dev/null.]]

I hope this doesn't count as a refutation...

I don't think GNU Emacs keyboard macros are Turing-equivalent, but I
think Gosling Emacs may have been.  The major missing feature in most
Emacs keyboard macros is a decent conditional.  You can loop a
user-specified number of times (using a numeric argument), and you can
ask the user whether to continue (c-x q -- kbd-macro-query), but there
is usually no built-in way for a keyboard macro to make decisions on
its own (I don't count using m-esc (eval-expression), since the point
is to NOT resort to Lisp, and for a similar reason m-! is not
allowed).  Gosling Emacs, on the other hand, had a whole bunch of
commands that existed solely to provide control structure in macros.
The only ones I remember specifically were c-x { and c-x } (although I
may have the prefix wrong), which began and ended blocks of commands
(so you didn't have to use nested keyboard macros whenever you wanted
to group things).


Barry Margolin
Thinking Machines Corp.

barmar@think.com
{uunet,harvard}!think!barmar

mike@arizona.edu (Mike Coffin) (02/17/89)

From article <36460@think.UUCP>, by barmar@think.COM (Barry Margolin):
> I don't think GNU Emacs keyboard macros are Turing-equivalent, but I
> think Gosling Emacs may have been.  The major missing feature in most
> Emacs keyboard macros is a decent conditional. [...]
> (I don't count using m-esc (eval-expression), since the point
> is to NOT resort to Lisp [...]

Ah, but you can resort to lisp exactly once: after you decide exactly 
what form the "decent conditional" will take.  Then you bind it
to a key and you're on your way.

-- 
Mike Coffin				mike@arizona.edu
Univ. of Ariz. Dept. of Comp. Sci.	{allegra,cmcl2}!arizona!mike
Tucson, AZ  85721			(602)621-2858

barmar@think.COM (Barry Margolin) (02/17/89)

In article <9275@megaron.arizona.edu> mike@arizona.edu (Mike Coffin) writes:
>Ah, but you can resort to lisp exactly once: after you decide exactly 
>what form the "decent conditional" will take.  Then you bind it
>to a key and you're on your way.

But that's one time too many.  The issue is whether keyboard macros
themselves are Turing-equivalent.  If you are allowed to define new
commands then you are stepping outside the keyboard macro world.  We
already know that Lisp is Turing-equivalent, so even one foray into
Lisp makes the question uninteresting.


Barry Margolin
Thinking Machines Corp.

barmar@think.com
{uunet,harvard}!think!barmar