Note: This article is part of my Emacs for Writers series, a complete tutorial on Emacs for non-programmers.
Part of your job as a writer is to keep track of various relevant metrics. For writers, word counts are important; they are the key metric publishers and editors will need to know to make sure your content fits their specifications. Emacs can provide you with word counts and much much more.
Table of Contents
Counting words and word counters
You can easily count words using certain functions or packages. If you want to track word counts while you type and set goals, you should check out the word count goals package.
However, I’ll warn you that counting words dynamically can slow down Emacs in larger documents.
The easiest, most reliable way to get your word count is to use the count-words
function that comes with Emacs. You can run it with M-x
typing count-words
, or you can use the default keybinding: M-=
.
Tracking lines and line numbers
Likewise, you can get line numbering in your buffer. Line numbering is more important in programming, but if you’re writing poetry, or for any reason wish to see your lines counted, you can enable this feature.
Here is a line you can add to your config file:
(display-line-numbers-mode 1)
Relative line numbers
Relative line numbers is a wonderful little feature, but like dynamic word count packages, it can slow you down in a larger file.
Instead of displaying lines in a sequential fashion, from top to bottom, this will count your lines up and down starting at your current line:
(setq display-line-numbers-type 'relative)
(display-line-numbers-mode 1)
Well done! You have completed this section of the race. Next, we’ll get to the graduation phase of the program: exporting your Org file to standard manuscript formatted professional documents for the writer’s marketplace.