More precise words-counting in org-mode.
In Org-mode, there are many elements that we do not want to include in word count, such as code blocks, options, and drawers. The usual practice is to use regular expressions to exclude them, but there are too many syntaxes in org-mode, making it difficult to fully include them with regular expressions. This package takes advange of the org-element API to filter the elements we want, count their words, and display the result on the modeline.
org-count-words-buffer
Count words in current org buffer. Like
count-words
but ingore words in some elements like src-block.org-count-words-region
Count the number of words in the region.
If called interactively, print a message reporting the number of words in the region (whether or not the region is active); with prefix ARG, report for the entire buffer rather than the region.
If called from Lisp, return the number of words between positions START and END.
org-count-words-subtree
Count words in current subtree.
If called from Lisp, return the number of words.
org-count-words-mode
Minor mode for displaying word count in the modeline.
org-count-words-elemnts
List of element types that should be included.
See =org-element-map for details.
org-count-words-functions
Defualt function to count words.
This function should take two argments(beg and end) and return a number.
org-count-words-no-recursive-elemnts
List of element types that should be exlucded in recursive map.
See
org-element-map
for details.org-count-words-element-functions
Alist of org elelemnt type and word-counting funtion.
Each function will be called with one arguemnt: the selected element.
org-count-words-buffer-idle-delay
Seconds to wait before updating the word counts in the current buffer.
org-count-words-region-idle-delay
Seconds to wait before updating the word counts in the selected region.
org-count-words-mode-line
Mode line construct for displaying current word count.
org-count-words-mode-line-format
The mode-line format for displaying current word count.
This value should be a
cons
whosecar
is a format string to display the word count of the current buffer, and whosecdr
is a format string to display the word count of the selected region and the current buffer.