unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* suggestion: function: buffer-bytes
@ 2007-07-01  0:18 T. V. Raman
  2007-07-01  1:39 ` Stefan Monnier
  0 siblings, 1 reply; 14+ messages in thread
From: T. V. Raman @ 2007-07-01  0:18 UTC (permalink / raw)
  To: emacs-devel

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@users.sf.net
WWW:    http://emacspeak.sf.net/raman/
AIM:    emacspeak       GTalk: tv.raman.tv@gmail.com
PGP:    http://emacspeak.sf.net/raman/raman-almaden.asc
Google: tv+raman 
IRC:    irc://irc.freenode.net/#emacs

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2007-07-09  2:44 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-01  0:18 suggestion: function: buffer-bytes T. V. Raman
2007-07-01  1:39 ` Stefan Monnier
2007-07-01  2:40   ` T. V. Raman
2007-07-01  6:31     ` David Kastrup
2007-07-01  8:22     ` Kenichi Handa
2007-07-01 12:39       ` Stefan Monnier
2007-07-02  0:48         ` Kenichi Handa
2007-07-01 17:47       ` T. V. Raman
2007-07-02  1:11         ` Kenichi Handa
2007-07-04 16:31           ` T. V. Raman
2007-07-05 14:42             ` Stefan Monnier
2007-07-09  2:44               ` Kenichi Handa
2007-07-01 19:34       ` Eli Zaretskii
2007-07-02  0:55         ` Kenichi Handa

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).