
I'm writing a gtk2hs-based text editor, and would like to implement continuous (swap-file based) autosave the way vim and emacs do it. Any suggestions for how to implement this in a cross-platform manner? Also, is there a library that returns standard config file locations on a per-platform basis? martin

http://hackage.haskell.org/package/bytestring-mmap
On 17/01/2012, Martin DeMello
I'm writing a gtk2hs-based text editor, and would like to implement continuous (swap-file based) autosave the way vim and emacs do it. Any suggestions for how to implement this in a cross-platform manner?
Also, is there a library that returns standard config file locations on a per-platform basis?
martin
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Matthew Farkas-Dyck wrote:
Since he's editing text, its a pity there isn't a text-mmap package :-). Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/

On 17/01/2012, Erik de Castro Lopo
Matthew Farkas-Dyck wrote:
Since he's editing text, its a pity there isn't a text-mmap package :-).
Yeah, I had the same thought.
Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Tue, Jan 17, 2012 at 5:49 PM, Erik de Castro Lopo
Matthew Farkas-Dyck wrote:
Since he's editing text, its a pity there isn't a text-mmap package :-).
Further question - my internal data representation is a vector of strings (it's a line-based editor). Is there a more efficient strategy to keep an mmap buffer in sync with the vector than simply allocating some large fixed size per line? martin

Martin DeMello wrote:
Further question - my internal data representation is a vector of strings (it's a line-based editor).
String or ByteString or Text? If its either of the first two, I think you should definitely look at Text.
Is there a more efficient strategy to keep an mmap buffer in sync with the vector than simply allocating some large fixed size per line?
Very much dependent on whether you are using String or one of the other two I would think. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/

On Tue, Jan 17, 2012 at 6:24 PM, Erik de Castro Lopo
Martin DeMello wrote:
Further question - my internal data representation is a vector of strings (it's a line-based editor).
String or ByteString or Text?
If its either of the first two, I think you should definitely look at Text.
Just plain String, mostly because it's what Gtk.Entry works with. I'll take a look at Text. martin

Martin DeMello wrote:
Just plain String, mostly because it's what Gtk.Entry works with. I'll take a look at Text.
Ah, maybe not. If your output representation *has* to be String its probably not worth using Text as an internal representation. I suspect that Gtk should really be updated to allow the use of Text instead of String. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/

Erik de Castro Lopo
Matthew Farkas-Dyck wrote:
Since he's editing text, its a pity there isn't a text-mmap package .
Well, this one: http://hackage.haskell.org/package/mmap works not only for Text but also for Windows and Macs. -- Gracjan

Says posix only. But googling for it brought up System.IO.MMap, which
does seem to be cross-platform.
martin
On Tue, Jan 17, 2012 at 5:46 PM, Matthew Farkas-Dyck
http://hackage.haskell.org/package/bytestring-mmap
On 17/01/2012, Martin DeMello
wrote: I'm writing a gtk2hs-based text editor, and would like to implement continuous (swap-file based) autosave the way vim and emacs do it. Any suggestions for how to implement this in a cross-platform manner?
Also, is there a library that returns standard config file locations on a per-platform basis?
martin
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (4)
-
Erik de Castro Lopo
-
Gracjan Polak
-
Martin DeMello
-
Matthew Farkas-Dyck