emacs-devel
[Top][All Lists]
Advanced

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

Re: streams are cool, you could stream virtually anything!


From: Nicolas Petton
Subject: Re: streams are cool, you could stream virtually anything!
Date: Thu, 05 Nov 2015 14:45:50 +0100
User-agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/25.0.50.1 (x86_64-unknown-linux-gnu)

Phillip Lord <address@hidden> writes:

> Emacs is single threaded, so the only thing that can change the buffer
> during a while loop is the stuff in the while loop. So, with m-buffer,
> for instance, you get back a list of markers based on the world now.
>
> With laziness, though, do the results of the stream depend on the state
> of the buffer when the stream is created, realised, or the state of the
> buffer now.

It depends on the state of the buffer during the execution of the
mapping in my example, i.e. when the stream is realized, so the behavior
is similar to the while loop.

> I don't know if this is a problem or not, which is why I am asking.

No, it's not, unless you do things like (`seq-do' is eager):

    (seq-do (lambda (match-data)
               (something-that-modifies-the-buffer)
               ...)
             (stream-regexp buf ".*foo\\(.*\\)$")))))

But then it's just the same issue as with a while loop:

     (cl-loop
       while (re-search-forward "^  - \\(.*\\) :: \\(.*\\)$" end t)
       do (something-that-modifies-the-buffer)
       ...)

Nico

Attachment: signature.asc
Description: PGP signature


reply via email to

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