On Thu, Nov 27, 2008 at 3:22 AM, Gwern Branwen <[EMAIL PROTECTED]> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
>
> On Wed, Nov 26, 2008 at 5:03 PM, Gwern Branwen  wrote:
>> setBufferContents doesn't seem to exist. At least, recursive grep
>> can't find anything but setBuffer.
>
> OK, so I found two ways to do this:
>
>> setBufferContents :: (MonadEditor m) => String -> m BufferRef
>> setBufferContents article = withEditor $ stringToNewBuffer "Ireader article" 
>> (B.fromString article)

You can use the replaceBufferContent function that I pointed to.

> [Attempts to read the buffer contents into a String]

> We really need to make this stuff easier. I vote that we start by
> adding some basic primitives like a getCurrentBuffer :: YiM String...

It's not difficult if you know where to look. Reading Yi.Buffer.HighLevel
would help you here. In general all the buffer-manipulation API are in
the BufferM monad. You can lift it to YiM by using withBuffer. The function
will then operate on the current buffer.

Cheers,
JP.

--~--~---------~--~----~------------~-------~--~----~
Yi development mailing list
yi-devel@googlegroups.com
http://groups.google.com/group/yi-devel
-~----------~----~----~----~------~----~------~--~---

Reply via email to