[Top][All Lists]

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

Re: how-many/count-matches for non-interactive use

From: Luc Teirlinck
Subject: Re: how-many/count-matches for non-interactive use
Date: Tue, 19 Oct 2004 20:14:11 -0500 (CDT)

Richard Stallman wrote:

   If most of the uses in Emacs are wrong,

There is one thing I know with absolute certainty: the current
behavior of `interactive-p' is correct for every single one of the
many keyboard macros I have ever written.  The proposed new behavior
would be wrong for every single macro I have ever written and for
which it would make any difference.  It would slow them down a lot and
those that print at least two different messages would hopelessly ruin
my *Messages* buffers by replacing important information with junk.
(Most of the time, keyboard macros are repeated countless times.)

A keyboard macro is a poor man's Lisp function.  There are two reasons
for using a keyboard macro: because the user does not know Lisp, or
because defining a keyboard macro takes less time than writing a Lisp
function.  Before I learned Elisp, I used tons of sometimes very
complex keyboard macros for the first reason.  Now I still
occasionally use keyboard macros for the second reason.  Probably the
main reason to use a Lisp function instead of a keyboard macro (for
something that can actually be done using a keyboard macro) is that it
tends to run a lot faster.  The choice between keyboard macro and Lisp
function is determined by necessity or convenience and by execution
speed.  It has nothing to do with wanting or not wanting messages to
be printed to *Messages*.

Like during execution of a Lisp function and unlike real interactive
use, the user does not get to enter arguments in the minibuffer during
execution of a macro.  The arguments are given during definition of
the macro.  Like in a Lisp function, the user can not determine what
to do after each command in the macro, except the last.  A command
that is part of a keyboard macro is much more like a command invoked
from a Lisp function than a really interactively invoked command.

Actually, one has to be a lot _more_ careful with messages during
macro execution than during Lisp function execution.  The absolute
_worst_ time to print messages is during long loops.  It slows things
down tremendously and hopelessly clobbers *Messages*.  I use most
keyboard macros with very large or zero numeric arguments, that is, in
long loops.  I suspect most people do.



reply via email to

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