From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Francesco Scaglioni Newsgroups: gmane.emacs.help Subject: Re: Count characters in emacs? Date: Wed, 26 Feb 2003 11:09:09 +0000 (GMT) Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <20030226.110909.74722278.fgs@epulse.net> References: <250220031348399183%skinny@bones.com> <1438-Tue25Feb2003215529+0200-eliz@elta.co.il> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1046257774 3223 80.91.224.249 (26 Feb 2003 11:09:34 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 26 Feb 2003 11:09:34 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18nzRK-0000pe-00 for ; Wed, 26 Feb 2003 12:09:30 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18nzQj-0005BX-07 for gnu-help-gnu-emacs@m.gmane.org; Wed, 26 Feb 2003 06:08:53 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18nzQV-000593-00 for help-gnu-emacs@gnu.org; Wed, 26 Feb 2003 06:08:39 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18nzQ0-0004xh-00 for help-gnu-emacs@gnu.org; Wed, 26 Feb 2003 06:08:09 -0500 Original-Received: from mail1.nhs.uk ([213.120.235.81]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18nzOJ-0004Wy-00 for help-gnu-emacs@gnu.org; Wed, 26 Feb 2003 06:06:23 -0500 Original-Received: from hn-ext by mail1.nhs.uk (Sendmail 8.8.8) with esmtp id 18nzOF-0001I2-00; Wed, 26 Feb 2003 11:06:19 +0000 Original-Received: from relay.nhs.uk (194.62.42.143) by relayint2.nhs.uk (Syntegra-I2 6.5.016) id 3E554311000F5547 for help-gnu-emacs@gnu.org; Wed, 26 Feb 2003 11:06:19 +0000 Original-Received: from localhost (194.155.32.229) by relay.nhs.uk (Syntegra-3 6.5.026) id 3E437F4800558053 for help-gnu-emacs@gnu.org; Wed, 26 Feb 2003 11:06:19 +0000 Original-To: help-gnu-emacs@gnu.org In-Reply-To: <1438-Tue25Feb2003215529+0200-eliz@elta.co.il> X-Mailer: Mew version 3.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:7137 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:7137 I have this is what I call misc.el which gets loaded at run time -- relies on the aforementioned WC but works fine with M-x wc return. I did not write this myself but cannnot remember where I cribbed it from ( all credit goes to whoever it was ). Cheers F ;; WORD COUNT (defun wc () "Count the words in the current buffer, show the result in the minibuffer" (interactive) (save-excursion (save-restriction (widen) (goto-char (point-min)) (let ((count 0)) (while (forward-word 1) (setq count(1+ count))) (message "There are %d words in the buffer" count)))))