From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: Why does the minibuffer get updated Date: Thu, 15 Jan 2009 22:36:41 -0500 Organization: A noiseless patient Spider Message-ID: References: <726d8899-cdb6-45a8-a30d-8ce27270c7ba@f40g2000pri.googlegroups.com> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1232077250 18605 80.91.229.12 (16 Jan 2009 03:40:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 16 Jan 2009 03:40:50 +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 04:42:02 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 1LNfap-00046G-P5 for geh-help-gnu-emacs@m.gmane.org; Fri, 16 Jan 2009 04:42:00 +0100 Original-Received: from localhost ([127.0.0.1]:35624 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LNfZZ-00084h-8a for geh-help-gnu-emacs@m.gmane.org; Thu, 15 Jan 2009 22:40:41 -0500 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!news.motzarella.org!motzarella.org!news.motzarella.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 49 Original-X-Trace: news.eternal-september.org U2FsdGVkX1/A7YLaKO77eu1R24rWVS4661PjtB5Z6WrRKpoUXhykagMlAoYYg0O21BquYcQKwE0trF+Qkt3QqeyzkmC37kAVDPQEwDwsU0/Mec1S62UmP19/KhM+UhjzXaWTf6AprJk= Original-X-Complaints-To: Please send complaints to abuse@motzarella.org with full headers Original-NNTP-Posting-Date: Fri, 16 Jan 2009 03:36:41 +0000 (UTC) X-Auth-Sender: U2FsdGVkX19kmkHP0py2p+33iTHSHoD592a6CfcRHwk= Cancel-Lock: sha1:gRwEFqx/fbutj00I0G3C+IkhY9s= User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Mail-Copies-To: nobody Original-Xref: news.stanford.edu gnu.emacs.help:166068 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:61392 Archived-At: In article <726d8899-cdb6-45a8-a30d-8ce27270c7ba@f40g2000pri.googlegroups.com>, Decebal wrote: > I like to have a wordcount displayed. I tried it with the following: > (defun buffer-count-words() > (interactive) > (let ((occurences > (how-many "\\w+" (point-min) (point-max)) > ) > ) > (string-match "[0-9]*" occurences) > (match-string 0 occurences) > ) > ) > > (defvar buffer-count-words > nil > "*Number of words in the buffer." > ) > > (defun buffer-update-word-count() > (interactive) > (setq buffer-count-words (buffer-count-words)) > (force-mode-line-update) > ) > > (unless buffer-count-words > (run-with-idle-timer 1 t 'buffer-update-word-count) > ) > > (unless (memq 'buffer-count-words global-mode-string) > (add-to-list 'global-mode-string " words: " t) > (add-to-list 'global-mode-string 'buffer-count-words t) > ) > > 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. What version of Emacs are you running? -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***