help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Word count in Emacs


From: B. T. Raven
Subject: Re: Word count in Emacs
Date: Sat, 15 Sep 2012 18:23:25 -0500
User-agent: Mozilla/5.0 (Windows NT 5.0; rv:12.0) Gecko/20120428 Thunderbird/12.0.1

> 
> 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
>>
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]