emacsmerlin

Where does the automatically generated file #hello.ml# for hello.ml come from?


I am working on a file called hello.ml in Ocaml under emacs Taureg Merlin mode, and I realize there's file #hello.ml# (not hellocaml.ml~) in the same directory. I have only used the toplevel with #use "hello.ml" and called ocamlbuild during the time. The file #hello.ml# seems to be just a plain text snapshot of hello.ml at some point. I tried to update hello.ml and use #use in toplevel again, but #hello.ml# is not in sync with hello.ml. Does anyone have an idea where this file comes from?


Solution

  • This is an auto-save file from Emacs. It only exists when you have unsaved changes in Emacs. Thanks to this file, in case your computer (or just Emacs) crashes with unsaved changes, Emacs can restore the unsaved changes when you restart and open the file again.

    (I'm describing the default behavior, see the manual for how to configure it.)