emacs-devel
[Top][All Lists]
Advanced

[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: Thu, 21 Oct 2004 17:13:29 -0500 (CDT)

I took a closer look at what started this thread, `how-many'.  I
somewhat changed my opinion on this particular example.  It indeed
seems to make some sense to print that message in a keyboard macro in
some situations (if `how-many' is the very last command in the macro).
But it makes equally much sense in the same situations when called from
Lisp.  Remember that `how-many' without Alexander's patch prints the
message even when called from Lisp.  Alexander's latest patch looks
OK because you still are able to print the message even from Lisp.
Trying to solve the problem by changing interactive-p makes in my
opinion no sense, because if you sometimes need the message in a
keyboard macro, you automatically also sometimes need the message from
Lisp, for instance if you translate your keyboard macro into a Lisp
function for efficiency.

There are many messages that make no sense when called from a keyboard
macro, so the present behavior of `interactive-p' makes sense.  In
situations where the message should appear in a keyboard macro, one
should always use an argument, because then you will sometimes also
need to print the message from Lisp.  This is exactly what is
currently clearly documented in the Elisp manual and in plenty of
other places.

       When the user currently tests a keyboard macro, he tests it with the
       current behavior.  Hence, the current behavior of `interactive-p'
       determines whether the macro does what the user wants it to do,

   This argument assumes that people who wrote this code knew what they
   were doing.  I can't assume that.  I want to see what sort of messages
   they really are.  I want someone to look at them.

The argument assumed that _keyboard macro users_ know what they want
their macros to do.

I am aware that some people who write code do not know what they are
doing, although I would hope that this does not apply to the majority
of people whose code winds up in the Emacs sources.  I have not seen a
flood of bug reports related to uses of `interactive-p' that were
inappropriate for macros.

Sincerely,

Luc.







reply via email to

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