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: Alexander Pohoyda
Subject: Re: how-many/count-matches for non-interactive use
Date: 15 Oct 2004 08:28:11 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Richard Stallman <address@hidden> writes:

>     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.

(defun how-many (regexp &optional rstart rend)
  "..."
  (interactive
   (keep-lines-read-args "How many matches for (regexp): "))

How do I use "p" here?


-- 
Alexander Pohoyda <address@hidden>
PGP Key fingerprint: 7F C9 CC 5A 75 CD 89 72  15 54 5F 62 20 23 C6 44




reply via email to

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