Counting words

The standard Emacs distribution contains functions for counting the number of lines and words within a region.

Certain types of writing ask you to count words. Thus, if you write an essay, you may be limited to 800 words; if you write a novel, you may discipline yourself to write 1000 words a day. It seems odd, but for a long time, Emacs lacked a word count command. Perhaps people used Emacs mostly for code or types of documentation that did not require word counts; or perhaps they restricted themselves to the operating system word count command, wc. Alternatively, people may have followed the publishers’ convention and computed a word count by dividing the number of characters in a document by five.

There are many ways to implement a command to count words. Here are some examples, which you may wish to compare with the standard Emacs command, count-words-region.