From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alexander Pohoyda Newsgroups: gmane.emacs.devel Subject: Re: how-many/count-matches for non-interactive use Date: 15 Oct 2004 08:28:11 +0200 Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: <874qkwmr5w.fsf@oak.pohoyda.family> References: <87pt3m5vqk.fsf@oak.pohoyda.family> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1097821735 27832 80.91.229.6 (15 Oct 2004 06:28:55 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 15 Oct 2004 06:28:55 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 15 08:28:44 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CILZz-0002cF-00 for ; Fri, 15 Oct 2004 08:28:44 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CILh7-0007yq-Iq for ged-emacs-devel@m.gmane.org; Fri, 15 Oct 2004 02:36:05 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CILgz-0007yb-Mg for emacs-devel@gnu.org; Fri, 15 Oct 2004 02:35:57 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CILgz-0007yP-9y for emacs-devel@gnu.org; Fri, 15 Oct 2004 02:35:57 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CILgz-0007yM-6g for emacs-devel@gnu.org; Fri, 15 Oct 2004 02:35:57 -0400 Original-Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1CILZY-0002At-Bk for emacs-devel@gnu.org; Fri, 15 Oct 2004 02:28:16 -0400 Original-Received: (qmail 19071 invoked by uid 65534); 15 Oct 2004 06:28:14 -0000 Original-Received: from p508431E2.dip0.t-ipconnect.de (EHLO www2.gmx.net) (80.132.49.226) by mail.gmx.net (mp017) with SMTP; 15 Oct 2004 08:28:14 +0200 X-Authenticated: #14602519 Original-Received: from oak.pohoyda.family (localhost [127.0.0.1]) by www2.gmx.net (8.12.10/8.12.10) with ESMTP id i9F6SCp2000396; Fri, 15 Oct 2004 08:28:12 +0200 (CEST) (envelope-from alexander.pohoyda@gmx.net) Original-Received: (from apog@localhost) by oak.pohoyda.family (8.12.10/8.12.10/Submit) id i9F6SBb5000393; Fri, 15 Oct 2004 08:28:11 +0200 (CEST) (envelope-from alexander.pohoyda@gmx.net) X-Authentication-Warning: oak.pohoyda.family: apog set sender to alexander.pohoyda@gmx.net using -f Original-To: rms@gnu.org In-Reply-To: Original-Lines: 37 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:28418 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:28418 Richard Stallman 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 PGP Key fingerprint: 7F C9 CC 5A 75 CD 89 72 15 54 5F 62 20 23 C6 44