X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=elisp.git;a=blobdiff_plain;f=text-counters.el;h=4f08d682086150d379c25ceb8ddf4fc450254390;hp=484bc946cf9130e40f7eb1997767043f5dc0ea00;hb=41d67536a6418bc1b6259cc3f390b892cb931417;hpb=3d7cf3e751b0ef3ef63dffdea8b5d09828c2341a diff --git a/text-counters.el b/text-counters.el index 484bc94..4f08d68 100644 --- a/text-counters.el +++ b/text-counters.el @@ -18,6 +18,17 @@ ;; 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"))) + "The face for the alarm-vc modeline message.") + ;; Counts the number of words and characters between the previous and ;; the next line of '-' (with at least four '-' in each line) @@ -30,7 +41,8 @@ (match-beginning 0))))) (when (and a b) - (format "%dw %dc " (count-words a b) (- b a)) + (propertize (format "%dw %dc " (count-words a b) (- b a)) + 'face 'tc/modeline-face) ))) ;; Add the said counters into the modeline