From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "B. T. Raven" Newsgroups: gmane.emacs.help Subject: Re: Word count in Emacs Date: Sat, 15 Sep 2012 18:23:25 -0500 Organization: NewsGuy - Unlimited Usenet $19.95 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1347751513 15593 80.91.229.3 (15 Sep 2012 23:25:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Sep 2012 23:25:13 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Sep 16 01:25:17 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TD1jg-0000Xu-5t for geh-help-gnu-emacs@m.gmane.org; Sun, 16 Sep 2012 01:25:16 +0200 Original-Received: from localhost ([::1]:35813 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TD1jc-0007V4-66 for geh-help-gnu-emacs@m.gmane.org; Sat, 15 Sep 2012 19:25:12 -0400 Original-Path: usenet.stanford.edu!news.glorb.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!spln!extra.newsguy.com!newsp.newsguy.com!news6 Original-Newsgroups: gnu.emacs.help Original-Lines: 45 Original-NNTP-Posting-Host: pc1673e5e3a78a16f8f629ac15ff59f1016de3b2341c84cb6.newsdawg.com User-Agent: Mozilla/5.0 (Windows NT 5.0; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 In-Reply-To: X-Received-Bytes: 1785 Original-Xref: usenet.stanford.edu gnu.emacs.help:194461 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:86802 Archived-At: > > M-x count- TAB Using this I just find my own function. I think I looked at C-h f count tab before defining this. Am I masking an original count-words function in ver. 23.3? > > or > > M-= (does exactly what you are trying to do here, I suppose) That is count-lines-regions, returning no. of lines and chars, not words unless it's been enhanced in ver. 24 Thanks, anyway Ed > > "B. T. Raven" writes: > >> Can anyone give me a clue why the following doesn't print a number in >> the mini-buffer or to the *Messages* buffer?: >> >> (defun count-words (start end) ;; alias wce >> "Print number of words in the region." >> (interactive "r") >> (save-excursion >> (save-restriction >> (narrow-to-region start end) >> (goto-char (point-min)) >> (count-matches "\\sw+")))) >> >> an alias is assigned so that I can invoke with >> >> M-x wce (word count emacs) >> >> Thanks, >> >> Ed >> >