diff --git a/man/utoprc.5 b/man/utoprc.5 index f36dd7c..fb42b0a 100644 --- a/man/utoprc.5 +++ b/man/utoprc.5 @@ -27,6 +27,14 @@ ignored. Configuration lines are of the form: may contains the '*' star character. In that case any key which match the pattern is given the value after the colon. +The boolean key +.I autoload +can be set to +.I false +to disable the autoloading of files in +.I $OCAML_TOPLEVEL_PATH/autload +at startup. + The key .I profile may have the value diff --git a/src/lib/uTop_main.ml b/src/lib/uTop_main.ml index 3ce2ad1..e2f8c93 100644 --- a/src/lib/uTop_main.ml +++ b/src/lib/uTop_main.ml @@ -1108,7 +1108,7 @@ let load_init_files dir = Array.iter (fun fn -> if Filename.check_suffix fn ".ml" then - ignore (Toploop.use_silently Format.err_formatter fn : bool)) + ignore (Toploop.use_silently Format.err_formatter (Filename.concat dir fn) : bool)) files ;; @@ -1124,7 +1124,7 @@ let common_init () = | Some dir -> Topdirs.dir_directory dir; let autoload = Filename.concat dir "autoload" in - if Sys.file_exists autoload then + if !UTop_private.autoload && Sys.file_exists autoload then load_init_files autoload | None -> ()); (* Load user's .ocamlinit file. *) diff --git a/src/lib/uTop_private.ml b/src/lib/uTop_private.ml index 4a87469..49cf515 100644 --- a/src/lib/uTop_private.ml +++ b/src/lib/uTop_private.ml @@ -24,3 +24,5 @@ type ui = Console | Emacs let ui, set_ui = S.create Console let error_style = ref LTerm_style.none + +let autoload = ref true diff --git a/src/lib/uTop_styles.ml b/src/lib/uTop_styles.ml index cb7ace4..3ecbbb6 100644 --- a/src/lib/uTop_styles.ml +++ b/src/lib/uTop_styles.ml @@ -84,6 +84,7 @@ let load () = | "" -> () | str -> raise (LTerm_resources.Error (Printf.sprintf "invalid profile %S" str))); UTop_private.error_style := styles.style_error; + UTop_private.autoload := LTerm_resources.get_bool "autoload" res <> Some false; return () with | Unix.Unix_error(Unix.ENOENT, _, _) -> diff --git a/utoprc-dark b/utoprc-dark index 757f397..ec5dd69 100644 --- a/utoprc-dark +++ b/utoprc-dark @@ -18,3 +18,6 @@ quotation.foreground: x-purple error.foreground: red directive.foreground: x-lightsteelblue parenthesis.background: blue + +! uncomment the next line to disable autoload files +! autoload: false diff --git a/utoprc-light b/utoprc-light index a70de82..7a4fb9b 100644 --- a/utoprc-light +++ b/utoprc-light @@ -18,3 +18,6 @@ quotation.foreground: x-purple error.foreground: red directive.foreground: x-mediumorchid4 parenthesis.background: light-blue + +! uncomment the next line to disable autoload files +! autoload: false