;; Counting various entities in text
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defun ff/count-char ()
- "Prints the number of characters between the first previous \"--\"
-and the firt next \"--\"."
- (interactive)
- (let ((from (save-excursion (re-search-backward "^--$\\|BEGIN_COUNT" nil t)))
- (to (save-excursion (re-search-forward "^--$\\|END_COUNT" nil t))))
- (if (and to from) (message "%d character(s)" (- to from 6))
- (error "Can not find the -- delimiters"))))
-
-(defun ff/count-words ()
- "Print number of words between the first previous \"--\" and the
-firt next \"--\"."
- (interactive)
- (let ((from (save-excursion (re-search-backward "^--$" nil t)))
- (to (save-excursion (re-search-forward "^--$" nil t))))
- (if (and to from)
- (save-excursion
- (goto-char from)
- (let ((count 0))
- (while (< (point) to)
- (re-search-forward "\\w+\\W+")
- (setq count (1+ count)))
- (message "%d word(s)" count)))
- (error "Can not find the -- delimiters"))))
-
(defun ff/word-occurences ()
"Display in a new buffer the list of words sorted by number of
occurrences "
)
)
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(load "text-counters.el")
+
+;; Add them when entering the text-mode
+
+(add-hook 'text-mode-hook 'tc/add-text-counters-in-modeline)
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; A function to remove temporary alarm windows
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;