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: Ted Zlatanov
Subject: Re: docs for insert-file-contents use 'bytes'
Date: Fri, 03 Oct 2008 08:55:40 -0500
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux)

On Thu, 02 Oct 2008 14:55:10 -0400 Stefan Monnier <address@hidden> wrote: 

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 :)

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

You're right, usually the user will ask for sequential access to large
files so these optimizations should work.  

It needs to be as fast as possible regardless, because searching through
large amounts of data is painful (especially if the search fails) and I
expect searching to be one of the most common needs when viewing large
files.

Editing is another really nasty problem, of course, so I plan to make
the mode read-only at first.

Ted





reply via email to

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