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: Richard Stallman
Subject: Re: how-many/count-matches for non-interactive use
Date: Thu, 14 Oct 2004 20:26:24 -0400

    How about this patch?

    Index: replace.el
    ===================================================================
    RCS file: /cvsroot/emacs/emacs/lisp/replace.el,v
    retrieving revision 1.171
    diff -u -r1.171 replace.el
    --- replace.el      30 May 2004 21:50:35 -0000      1.171
    +++ replace.el      13 Oct 2004 18:14:35 -0000
    @@ -490,7 +490,9 @@
            (if (= opoint (point))
                (forward-char 1)
              (setq count (1+ count))))
    -      (message "%d occurrences" count))))
    +      (if (interactive-p)
    +     (message "%d occurrences" count)
    +   count))))

interactive-p is the wrong function to call here, because it is nil
when the command is called froma keyboard macro.  The right thing
to do here is to take an argument saying whether to print the message,
and use "p" in the interactive spec to set that argument non-nil
in an interactive call.

It seems that interactive-p as currently defined is very rarely useful
-- perhaps never.  Perhaps we should change interactive-p to ignore
whether the command is running from a macro and do what most people
seem to expect.

It would be useful for someone to find all calls to interactive-p
and see if any of them really want interactive-p to do what
it is currently defined to do.

I just grepped for it, and looked at two calls in bookmark.el;
I think the second one should be changed, but I can't tell
about the first with a quick glance.  I looked at the one call
in emerge.el and I think it should be changed.  I looked at
the call in env.el and I think it should be changed.

I looked at the call in faces.el, in describe-face, where it is used
as an argument to help-setup-xref.  It tells whether to clear the
stack of help xrefs followed.  I tend to think this should be changed,
because the command should behave the same in a macro as it would when
not called from a macro.

So are there any calls to interactive-p that really want it to return
nil when running in a keyboard macro?




reply via email to

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