HTMLタグ以外の文字列をカウント。

2chのスレhttp://pc11.2ch.net/test/read.cgi/software/1194361643/964を見てやってみた。ステータスバーのところに文字数が出る。

(defun count-innerText()
  "セレクションで選択した箇所のhtmlタグ以外の文字列をカウント"
  (interactive)
  (save-excursion
	(if (pre-selection-p)
		(let ((str (selection-start-end (start end)
					 (buffer-substring start end))))
		  (setq str (substitute-string str "<[^>]*>\\|\n" ""))
		  (message "~A" (length str))
		  ))
	))
(global-set-key '(#\C-9) 'count-innerText);キーは適当