Improve spacemacs/count-word-analysis

Also display overview information using regular count-words function.
This commit is contained in:
syl20bnr 2017-01-19 17:16:56 -05:00
parent c6bf7f7664
commit a00179c13f
1 changed files with 7 additions and 2 deletions

View File

@ -924,7 +924,10 @@ A non-nil argument sorts in reverse order."
"Count how many times each word is used in the region. "Count how many times each word is used in the region.
Punctuation is ignored." Punctuation is ignored."
(interactive "r") (interactive "r")
(let (words alist_words_compare (formated "")) (let (words
alist_words_compare
(formated "")
(overview (call-interactively 'count-words)))
(save-excursion (save-excursion
(goto-char start) (goto-char start)
(while (re-search-forward "\\w+" end t) (while (re-search-forward "\\w+" end t)
@ -951,7 +954,9 @@ Compare them on count first,and in case of tie sort them alphabetically."
(setq formated (concat formated (format "[%s: %d], " name count))))) (setq formated (concat formated (format "[%s: %d], " name count)))))
(when (interactive-p) (when (interactive-p)
(if (> (length formated) 2) (if (> (length formated) 2)
(message (substring formated 0 -2)) (message (format "%s\nWord count: %s"
overview
(substring formated 0 -2)))
(message "No words."))) (message "No words.")))
words)) words))