emacs-devel
[Top][All Lists]
Advanced

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

Re: suggestion: function: buffer-bytes


From: Kenichi Handa
Subject: Re: suggestion: function: buffer-bytes
Date: Mon, 02 Jul 2007 09:55:27 +0900
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/23.0.0 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

In article <address@hidden>, Eli Zaretskii <address@hidden> writes:

> > From: Kenichi Handa <address@hidden>
> > Date: Sun, 01 Jul 2007 17:22:29 +0900
> > Cc: address@hidden, address@hidden, address@hidden
> > 
> > In emacs-unicode-2, you can use a little bit faster version.
> > 
> > (defun buffer-encoded-size (&optional buffer coding)
> >   "Return the encoded size of the current byffer in bytes.
> > ..."
> >   (save-excursion
> >     (and buffer (set-buffer buffer))
> >     (or coding
> >     (setq coding buffer-file-coding-system))
> >     (length (encode-coding-region (point-min) (point-max) coding t))))

> Why can't he use this version in Emacs 22?

Because the 4th argument DESTINATION of encode-coding-region
is introduced by emacs-unicode-2.

Optional 4th arguments DESTINATION specifies where the encoded text goes.
If nil, the region between start and end is replace by the encoded text.
If buffer, the encoded text is inserted in the buffer.
If t, the encoded text is returned.

---
Kenichi Handa
address@hidden




reply via email to

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