Update.
[elisp.git] / text-counters.el
index fb24df7..e68e677 100644 (file)
 ;; Contact <francois@fleuret.org> for comments & bug reports             ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+;; This script automatigally count the number of characters and words
+;; between "----" markers. To activate it automatically when switching
+;; to text-mode, just add to your emacs.el
+;;
+;; (add-hook 'text-mode-hook 'tc/add-text-counters-in-modeline)
+
 (defface tc/modeline-face
   '((((background light)) (:foreground "blue4"))
     (((background dark)) (:foreground "cyan")))
 
 (defun tc/text-counters-string () (interactive)
   (let ((a (save-excursion
-             (and (re-search-backward "^--.*--*$" nil t)
+             (and (re-search-backward "^[#% ]*--.*--*" nil t)
                   (match-end 0))))
         (b (save-excursion
-             (and (re-search-forward "^--.*--*$" nil t)
+             (and (re-search-forward "^[#% ]*--.*--*" nil t)
                   (match-beginning 0)))))
 
     (when (and a b)