[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: Kim F. Storm
Subject: Re: how-many/count-matches for non-interactive use
Date: Tue, 19 Oct 2004 12:29:48 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

Luc Teirlinck <address@hidden> writes:

> Richard Stallman wrote:
>    The immediate problem is that there are many uses of interactive-p,
>    and many of them, perhaps all, are now incorrect.  We need to either
>    change those uses or change interactive-p.
> It would definitely seem to be a lot better to change existing
> "incorrect" (whatever that means, it seems to be completely
> subjective) uses than to change `interactive-p'.  This way we will
> not break any currently correct code in the Emacs distribution, third
> party packages, user Elisp functions and, most importantly, user
> defined keyboard macros.  The current behavior has been in place for a
> long time and users have defined (and saved) their keyboard macros to
> work with that behavior.

Fully agree.

> The most convenient way to change any currently "wrong" uses would, in
> my opinion, be to go with Kim's suggestion:
>    (interactive-p)    => current behaviour
>    (interactive-p t)  => interactive or executing macro
>    (interactive-p 1)  => interactive or executing macro ONCE
> I am not _completely_ sure about the last line, however.

It would be true if C-x e or C-x e e e,
but not if M-2 C-x e or C-u C-x e.

>    Would someone like to check them?
> There are tons of them.  We can have 100 message long discussions
> about nearly every single one of them, because all of them are likely
> to be subjective and depend on the type of keyboard macro.  If we
> leave _everything_ as is we will not break one single currently
> correct keyboard macro.
> In as far as the current example is concerned, it would seem _wrong_
> to _try_ to show the how-many/count-matches messages in an executing
> keyboard macro, like it is wrong to _try_ to show _any_ message in a
> keyboard macro.  

I agree, so in the current example, interactive-p actually does the
right thing IMO.  So as there is no clear idea of what is "correct",
checking anything seems futile.

>                  The reason for that is that it does not work anyway.
> How do we execute this macro in such a way that "This is the message"
> gets printed in the echo area?  It does reliably get printed to
> *Messages*, but how many users routinely check *Messages*?

Actually, you can't!!!  

I tried to make a quick fix for this, but the "This is a message"
still doesn't appear... because there is an explicit check in the C
code for `message':

       ... output message in echo area ...

where the definition of INTERACTIVE closely matches that of

/* Nonzero if input is coming from the keyboard */

#define INTERACTIVE (NILP (Vexecuting_macro) && !noninteractive)

So no matter whether we use interactive-p in the current or new
form, it cannot be used to determine whether message should
print in the echo area during macro execution -- message doesn't
print in that case!

So what's the point in the whole discussion ?

Kim F. Storm <address@hidden> http://www.cua.dk

reply via email to

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