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 06:42:17 -0800 (PST) Organization: http://groups.google.com Message-ID: <99a1b4b3-801a-4fa3-a62e-1abd365a23da@a29g2000pra.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 1232120460 13339 80.91.229.12 (16 Jan 2009 15:41:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 16 Jan 2009 15:41:00 +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 16:42:13 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 1LNqpi-0005yp-HL for geh-help-gnu-emacs@m.gmane.org; Fri, 16 Jan 2009 16:42:06 +0100 Original-Received: from localhost ([127.0.0.1]:40070 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LNqoR-0002sY-St for geh-help-gnu-emacs@m.gmane.org; Fri, 16 Jan 2009 10:40:47 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!a29g2000pra.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 57 Original-NNTP-Posting-Host: 84.53.123.169 Original-X-Trace: posting.google.com 1232116937 25067 127.0.0.1 (16 Jan 2009 14:42:17 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 16 Jan 2009 14:42:17 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: a29g2000pra.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/2008121300 SUSE/3.0.5-1.1 Firefox/3.0.5,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:166080 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:61406 Archived-At: On 15 jan, 17:43, Decebal 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 is partly a version problem. With 'GNU Emacs 22.3.1 (i586-suse- linux-gnu, X toolkit, Xaw3d scroll bars) of 2008-12-03 on build19' it works with a few modifications. With: (defun buffer-count-words() (interactive) (how-many "\\w+" (point-min) (point-max)) ) and (defun buffer-update-word-count() (interactive) (setq buffer-count-words (number-to-string (buffer-count-words)) ) (force-mode-line-update) ) it works. The systems I can update, I am going to update. For the system I can not update I have to copy how-many out of replace.el.