help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Stream-based Scanning of File-Buffers


From: Ted Zlatanov
Subject: Re: Stream-based Scanning of File-Buffers
Date: Fri, 25 Sep 2009 15:07:23 -0500
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (gnu/linux)

On Fri, 25 Sep 2009 14:55:34 +0200 Juanma Barranquero <lekktu@gmail.com> wrote: 

JB> On Fri, Sep 25, 2009 at 14:12, Nordlöw <per.nordlow@gmail.com> wrote:
>> Is there a way to perform string/regexp scanning (using search-forward
>> or re-search-forward) in a file-buffer whose contents is loaded only
>> when it's needed, kind of like file streams in C, so that I only do a
>> physical read on the blocks that I actually scan and then skip the
>> rest of the file as soon as I get a hit.

JB> You can use `insert-file-contents' to implement something like that;
JB> presumably, the only tricky part is taking care of matches across
JB> block boundaries.

Unicode character boundaries are also a little nasty, since the offsets
for insert-file-contents are always byte-based.  A good stream layer
would abstract all of that away, but I think it has to be at least
partly implemented at the C level to be efficient.

Ted


reply via email to

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