Commits

Peter Szilagyi committed eda82ff

provisional fix for perpetual 'Starting' bug I introduced recently

  • Participants
  • Parent commits 88d475e
  • Tags 2013-02-04-roll-test

Comments (0)

Files changed (1)

File ocaml/omake/lib/project.ml

     Deferred.unit
   | Ok elisp ->
     logf t "New output";
-    (* Let's see if the file-based approach might be losing messages.
+    (* Keep the file up to date, because it's used to initialize the omake status buffer
+       when a fresh Emacs connects to a project. *)
+    let file = Files.elisp id in
+    Writer.save file ~contents:elisp >>| fun () ->
+    (* A file-based approach might lose messages, because Emacs evaluates this elisp
+       asynchronously.  In particular, by the time Emacs gets around to loading the file,
+       we may be somewhere in the process of writing the next version.
 
-       {[
-         let file = Files.elisp id in
-         Writer.save file ~contents:elisp >>| fun () ->
-         Emacs.Async.load_elisp_file id
-       ]}
+       [Emacs.Async.load_elisp_file id]
 
-       This has the disadvantage of sending lots of large log messages, although we can
-       tweak Emacs.send_str to override that. *)
-    Emacs.Async.send_gen ~id "%s" elisp;
-    Deferred.unit)
+       Fortunately, we can simply also send the elisp to Emacs, which will evaluate it in
+       the order it's received, in its entirety.  *)
+    Emacs.Async.send_gen ~id "%s" elisp)
 
 let kill_when_unwatched t =
   let ivar = Ivar.create () in