> Can anyone give me a clue why the following doesn't print a number in
> the mini-buffer or to the *Messages* buffer?:
>
> (defun count-words (start end) ;; alias wce
> "Print number of words in the region."
> (interactive "r")
> (save-excursion
> (save-restriction
> (narrow-to-region start end)
> (goto-char (point-min))
> (count-matches "\\sw+"))))
As you've defined it, the function returns a number, but it's not the
case that the return value of an interactive command is automatically
echoed in the mini-buffer. Compare:
(defun count-words (start end) ;; alias wce
"Print number of words in the region."
(interactive "r")
(save-excursion
(save-restriction
(narrow-to-region start end)
(goto-char (point-min))
(message (number-to-string (count-matches "\\sw+"))))))