help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Count characters in emacs?


From: Francesco Scaglioni
Subject: Re: Count characters in emacs?
Date: Wed, 26 Feb 2003 11:09:09 +0000 (GMT)

I have this is what I call misc.el which gets loaded at run time --
relies on the aforementioned WC but works fine with M-x wc return.  I
did not write this myself but cannnot remember where I cribbed it from
( all credit goes to whoever it was ).

Cheers

F

;; WORD COUNT
(defun wc ()
"Count the words in the current buffer, show the result in the
 minibuffer"
 (interactive)
 (save-excursion 
 (save-restriction
 (widen)
 (goto-char (point-min))
 (let ((count 0))
 (while (forward-word 1)
  (setq count(1+ count)))
(message "There are %d words in the buffer" count)))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]