unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "B. T. Raven" <btraven@nihilo.net>
To: help-gnu-emacs@gnu.org
Subject: Re: Word count in Emacs
Date: Sat, 15 Sep 2012 18:23:25 -0500	[thread overview]
Message-ID: <k332mo0ov4@news6.newsguy.com> (raw)
In-Reply-To: <mailman.8880.1347646427.855.help-gnu-emacs@gnu.org>


> 
> 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" <btraven@nihilo.net> 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
>>
> 



      parent reply	other threads:[~2012-09-15 23:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-14 17:55 Word count in Emacs B. T. Raven
2012-09-14 18:14 ` Jambunathan K
2012-09-14 19:28 ` Alp Aker
     [not found] ` <mailman.8893.1347650994.855.help-gnu-emacs@gnu.org>
2012-09-15 23:11   ` B. T. Raven
     [not found] ` <mailman.8880.1347646427.855.help-gnu-emacs@gnu.org>
2012-09-15 23:23   ` B. T. Raven [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=k332mo0ov4@news6.newsguy.com \
    --to=btraven@nihilo.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).