Hi,

Sharon Kimble <boudic...@skimble.plus.com> writes:

> How can I exempt an org-mode drawer, and its contents, from word counts
> please. I am using 'wc-mode' but I can't see how to do it.

It is not a solution with wc-mode, but maybe this simple function, based on
`count-words', can serve you. It counts the words in the buffer
excluding all drawers and their contents:

#+begin_src emacs-lisp
(defun my-count-words-in-org-buffer ()
  (interactive)
  (let ((words 0))
    (save-excursion
      (save-restriction
        (narrow-to-region (point-min) (point-max))
        (goto-char (point-min))
        (while (forward-word-strictly 1)
          (if (org-at-drawer-p)
              (re-search-forward ":END:")
            (setq words (1+ words))))))
    (message "Org buffer has %d word%s."
             words (if (= words 1) "" "s"))))
#+end_src

Best regards,

Juan Manuel 


Reply via email to