[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
how-many/count-matches for non-interactive use
From: |
Alexander Pohoyda |
Subject: |
how-many/count-matches for non-interactive use |
Date: |
13 Oct 2004 20:16:51 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 |
The `how-many' function is not especially friendly for non-interactive
use, because is issues a message.
Is there a better way to count matches from a lisp program?
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))))
(defvar occur-mode-map
--
Alexander Pohoyda <address@hidden>
PGP Key fingerprint: 7F C9 CC 5A 75 CD 89 72 15 54 5F 62 20 23 C6 44
- how-many/count-matches for non-interactive use,
Alexander Pohoyda <=
Re: how-many/count-matches for non-interactive use, Stefan, 2004/10/15