[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: Mon, 18 Oct 2004 20:58:53 -0500 (CDT)

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.

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.

   The first step in fixing this is to take inventory.  Which uses of
   interactive-p are correct with the current definition of
   interactive-p?  Which would be correct with the modified definition of
   interactive-p that would not check for macros?

I doubt that many uses are going to be obviously "correct" or
"incorrect".  It all depends on what the keyboard macro in which it is
going to be used is designed to do.  But users have designed (and
saved) their keyboard macros to work with the current behavior.  I
believe we should be very conservative before changing the current
behavior for any individual function.  Certainly, we should not change
the default behavior of `interactive-p'.

   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.  The reason for that is that it does not work anyway.

Try the following.

emacs -q

C-M-x the following:

(defun myfun ()
  (message "This is the message"))

Note, no `interactive-p'.

Move point to end of buffer.

C-x ( a M-x myfun RET C-x )

We now have defined a keyboard macro.


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*?

Maybe the above could be considered a bug that should be fixed.  But
even if this "bug" would be fixed, then if the macro is executed with
`C-x e', the "(Type e to repeat macro)" message will still overwrite
any message that the macro would try to print.



reply via email to

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