(defun count-ce-word (beg end)
"Count Chinese and English words in marked region."
(interactive "r")
(let* ((cn-word 0)
(en-word 0)
(total-word 0)
(total-byte 0))
(setq cn-word (count-matches "//cc" beg end)
en-word (count-matches "//w+//W" beg end)
total-word (+ cn-word en-word)
total-byte (+ cn-word (abs (- beg end))))
(message (format "总计: %d (汉字: %d, 英文: %d) , %d 字母."
total-word cn-word en-word total-byte))))
本文介绍了一个Emacs Lisp脚本,用于在选定区域内统计汉字与英文单词的数量,并计算总的字节数。该脚本使用了Emacs内置的正则表达式匹配功能来实现这一目的。
2690

被折叠的 条评论
为什么被折叠?



