From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Decebal Newsgroups: gmane.emacs.help Subject: Re: Why does the minibuffer get updated Date: Fri, 16 Jan 2009 03:21:45 -0800 (PST) Organization: http://groups.google.com Message-ID: <63756d8f-43ce-4084-892d-237d141d4aec@t26g2000prh.googlegroups.com> References: <726d8899-cdb6-45a8-a30d-8ce27270c7ba@f40g2000pri.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1232106372 29624 80.91.229.12 (16 Jan 2009 11:46:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 16 Jan 2009 11:46:12 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 16 12:47:24 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LNnAS-0003nP-4w for geh-help-gnu-emacs@m.gmane.org; Fri, 16 Jan 2009 12:47:16 +0100 Original-Received: from localhost ([127.0.0.1]:35736 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LNn9B-000877-ES for geh-help-gnu-emacs@m.gmane.org; Fri, 16 Jan 2009 06:45:57 -0500 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!postnews.google.com!t26g2000prh.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 59 Original-NNTP-Posting-Host: 84.53.123.169 Original-X-Trace: posting.google.com 1232104906 10857 127.0.0.1 (16 Jan 2009 11:21:46 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 16 Jan 2009 11:21:46 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: t26g2000prh.googlegroups.com; posting-host=84.53.123.169; posting-account=K-cdeAoAAAD_0d505kUtHXJaT5LFIu-3 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; nl; rv:1.9.0.5) Gecko/2008120121 Firefox/3.0.5,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:166075 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:61401 Archived-At: On Jan 16, 4:36=A0am, Barry Margolin wrote: > In article > <726d8899-cdb6-45a8-a30d-8ce27270c...@f40g2000pri.googlegroups.com>, > > > > =A0Decebal wrote: > > I like to have a wordcount displayed. I tried it with the following: > > =A0 =A0 (defun buffer-count-words() > > =A0 =A0 =A0 (interactive) > > =A0 =A0 =A0 (let ((occurences > > =A0 =A0 =A0 =A0 =A0 =A0 =A0(how-many "\\w+" (point-min) (point-max)) > > =A0 =A0 =A0 =A0 =A0 =A0 =A0) > > =A0 =A0 =A0 =A0 =A0 =A0 ) > > =A0 =A0 =A0 =A0 (string-match "[0-9]*" occurences) > > =A0 =A0 =A0 =A0 (match-string 0 occurences) > > =A0 =A0 =A0 =A0 ) > > =A0 =A0 =A0 ) > > > =A0 =A0 (defvar buffer-count-words > > =A0 =A0 =A0 nil > > =A0 =A0 =A0 "*Number of words in the buffer." > > =A0 =A0 =A0 ) > > > =A0 =A0 (defun buffer-update-word-count() > > =A0 =A0 =A0 (interactive) > > =A0 =A0 =A0 (setq buffer-count-words (buffer-count-words)) > > =A0 =A0 =A0 (force-mode-line-update) > > =A0 =A0 =A0 ) > > > =A0 =A0 (unless buffer-count-words > > =A0 =A0 =A0 (run-with-idle-timer 1 t 'buffer-update-word-count) > > =A0 =A0 =A0 ) > > > =A0 =A0 (unless (memq 'buffer-count-words global-mode-string) > > =A0 =A0 =A0 (add-to-list 'global-mode-string " words: " t) > > =A0 =A0 =A0 (add-to-list 'global-mode-string 'buffer-count-words t) > > =A0 =A0 =A0 ) > > > This does display the word count, but also keeps putting in the > > minibuffer ' occurences'. > > What am I doing wrong? > > It's presumably coming from the how-many function, although my > documentation says that it only displays the number if the fourth > argument "interactive" is t. =A0What version of Emacs are you running? At the moment I am working with: GNU Emacs 21.3.1 (i586-suse-linux-gnu, X toolkit, Xaw3d scroll bars) of 2008-05-16 on hammer3 And it is also in this one going wrong. I tried to add nil: (how-many "\\w+" (point-min) (point-max) nil) Nothing is displayed in the echo area (it is not the minibuffer I learned), but there is also nothing displayed after 'words: ' in the status bar. So that is not a solution.