From: Michael D. Lowis Date: Sat, 7 Oct 2017 01:57:14 +0000 (-0400) Subject: implemented Buf.load X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=b135c34f99927ee2b67bb06feb330e1dffff3387;p=archive%2Ftide-ocaml.git implemented Buf.load --- diff --git a/Makefile b/Makefile index 68289b8..6ed9a5e 100644 --- a/Makefile +++ b/Makefile @@ -25,12 +25,12 @@ endif #------------------------------------------------------------------------------- BINS = edit LIBOBJS = \ + lib/misc.$(OBJEXT) \ lib/tide.$(OBJEXT) \ lib/x11.$(OBJEXT) \ lib/cfg.$(OBJEXT) \ lib/rope.$(OBJEXT) \ lib/buf.$(OBJEXT) \ - lib/misc.$(OBJEXT) \ lib/x11_prims.o \ lib/misc_prims.o \ lib/utf8.o diff --git a/lib/buf.ml b/lib/buf.ml index 421d31a..bb811be 100644 --- a/lib/buf.ml +++ b/lib/buf.ml @@ -29,7 +29,10 @@ let create = { info = info; current = state; lastsave = state; undo = []; redo = [] } let load path = - create + let file = Rope.from_string (Misc.load_file path) in + let state = { nlines = 0; outpoint = 0; rope = file } + and info = { path = ""; modtime = 0; charset = Utf8; crlf = Unix } in + { info = info; current = state; lastsave = state; undo = []; redo = [] } let saveas buf path = ()