1 Jul 2007 02:18
suggestion: function: buffer-bytes
T. V. Raman <raman <at> users.sf.net>
2007-07-01 00:18:38 GMT
2007-07-01 00:18:38 GMT
Emacs built-in buffer-size returns the number of characters ---
in some situations one needs the count of bytes.
Here is a small function that does this --- perhaps it could be
ncluded in subr.el?
(defsubst buffer-bytes (&optional buffer)
"Return number of bytes in a buffer."
(save-excursion
(and buffer (set-buffer buffer))
(1- (position-bytes (point-max)))))
--
--
Best Regards,
--raman
Email: raman <at> users.sf.net
WWW: http://emacspeak.sf.net/raman/
AIM: emacspeak GTalk: tv.raman.tv <at> gmail.com
PGP: http://emacspeak.sf.net/raman/raman-almaden.asc
Google: tv+raman
IRC: irc://irc.freenode.net/#emacs
RSS Feed