From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jambunathan K Newsgroups: gmane.emacs.help Subject: Re: Word count in Emacs Date: Fri, 14 Sep 2012 23:44:38 +0530 Message-ID: <87zk4szd2p.fsf@gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1347646430 30954 80.91.229.3 (14 Sep 2012 18:13:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Sep 2012 18:13:50 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "B. T. Raven" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Sep 14 20:13:54 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 1TCaOn-0001T7-SR for geh-help-gnu-emacs@m.gmane.org; Fri, 14 Sep 2012 20:13:53 +0200 Original-Received: from localhost ([::1]:49383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCaOj-00042h-R5 for geh-help-gnu-emacs@m.gmane.org; Fri, 14 Sep 2012 14:13:49 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:46118) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCaOf-00042c-KM for help-gnu-emacs@gnu.org; Fri, 14 Sep 2012 14:13:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TCaOe-0008Go-8i for help-gnu-emacs@gnu.org; Fri, 14 Sep 2012 14:13:45 -0400 Original-Received: from mail-pb0-f41.google.com ([209.85.160.41]:65390) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCaOe-0008Gd-0z for help-gnu-emacs@gnu.org; Fri, 14 Sep 2012 14:13:44 -0400 Original-Received: by pbbro12 with SMTP id ro12so6872635pbb.0 for ; Fri, 14 Sep 2012 11:13:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=7hf4KRl2wkv+ttlBQZb/9avQZqL+lZMnu5aLGDvdrMs=; b=XAm5s7h3UtGLfjq0EDvYYY82zSApEqIM9fB9PBbjCdkYv/xHXs4AYJbglTIW6kwp7b GFBcoeQLs2guLYtInYEDm7c6PGh4BXFnszzVY5E4UivbSbkPWyulpUUJzbV/pUcM/7mi uEZ1js+q7YiaqVR1gw+TBPWBB3+iErzIMrLN2JZn5qHR34qsEXmmItQ934WYM+j1YPRx 2wtjaRSL/BK2/rrup+hReDsnhVDF4LQHTTSXiJXx1RVsnOGGM3Z6YaKzBUIhip2ObOOZ FsriTX6SlIMk4eH68Oc6buDnebAdmXwbvugBO3S+Fzs/mWltJYDzvPD51daCoYFJ2Tyu vs2g== Original-Received: by 10.66.81.201 with SMTP id c9mr4922123pay.80.1347646422927; Fri, 14 Sep 2012 11:13:42 -0700 (PDT) Original-Received: from debian-6.05 ([115.242.167.135]) by mx.google.com with ESMTPS id wf7sm1354817pbc.34.2012.09.14.11.13.39 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 14 Sep 2012 11:13:41 -0700 (PDT) In-Reply-To: (B. T. Raven's message of "Fri, 14 Sep 2012 12:55:44 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.41 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:86772 Archived-At: M-x count- TAB or M-= (does exactly what you are trying to do here, I suppose) "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 > --