From b135c34f99927ee2b67bb06feb330e1dffff3387 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Fri, 6 Oct 2017 21:57:14 -0400 Subject: [PATCH] implemented Buf.load --- Makefile | 2 +- lib/buf.ml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) 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 = () -- 2.52.0