X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=text-counters.el;h=6f2e65cd6dfe53e248c7e6c30faed6b689db4280;hb=e8563b3d9852fdad0637e2a25a22375100b45aa3;hp=fb24df7b529dc08589f88e31dbc4ebbbedb5c554;hpb=e4fb3b4c9b4a7982dce67a90db7b590a59b7af08;p=elisp.git diff --git a/text-counters.el b/text-counters.el index fb24df7..6f2e65c 100644 --- a/text-counters.el +++ b/text-counters.el @@ -18,6 +18,12 @@ ;; Contact 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"))) @@ -28,10 +34,10 @@ (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)