emacs-devel
[Top][All Lists]
Advanced

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

Re: docs for insert-file-contents use 'bytes'


From: Stefan Monnier
Subject: Re: docs for insert-file-contents use 'bytes'
Date: Thu, 02 Oct 2008 14:55:10 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

KH> How about reading a file in a unibyte buffer with
KH> no-conversion, and decode one page by one into a view
KH> buffer.   Except for UTF-16 encoding, it is safe to set the
KH> decoding boundary at newline positions.

> That could work, but I'd have to grab more than one page every time, so
> the math could get tricky.  I'll have to play with this when it comes up
> on my TODO list :)

I'm not sure why you'd need such trick anyway.  Supposedly when you need
to read a new chunk, it's because the user bumped into the end of the
previous chunk, so you've read the previous chunk and from that read you
should be able to compute the byte-position of the last
complete character.
If that doesn't work in some cases (e.g. because the encoding has state
so you can't just start reading from the byte position of the last
complete char), maybe insert-file-contents should return a "decoder
state" object when can then be passed back in.


        Stefan




reply via email to

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