fix startup files autoloading and allow to disable it
This commit is contained in:
parent
d11d83ba65
commit
5b0adae849
|
@ -27,6 +27,14 @@ ignored. Configuration lines are of the form:
|
||||||
may contains the '*' star character. In that case any key which match
|
may contains the '*' star character. In that case any key which match
|
||||||
the pattern is given the value after the colon.
|
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
|
The key
|
||||||
.I profile
|
.I profile
|
||||||
may have the value
|
may have the value
|
||||||
|
|
|
@ -1108,7 +1108,7 @@ let load_init_files dir =
|
||||||
Array.iter
|
Array.iter
|
||||||
(fun fn ->
|
(fun fn ->
|
||||||
if Filename.check_suffix fn ".ml" then
|
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
|
files
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -1124,7 +1124,7 @@ let common_init () =
|
||||||
| Some dir ->
|
| Some dir ->
|
||||||
Topdirs.dir_directory dir;
|
Topdirs.dir_directory dir;
|
||||||
let autoload = Filename.concat dir "autoload" in
|
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
|
load_init_files autoload
|
||||||
| None -> ());
|
| None -> ());
|
||||||
(* Load user's .ocamlinit file. *)
|
(* Load user's .ocamlinit file. *)
|
||||||
|
|
|
@ -24,3 +24,5 @@ type ui = Console | Emacs
|
||||||
let ui, set_ui = S.create Console
|
let ui, set_ui = S.create Console
|
||||||
|
|
||||||
let error_style = ref LTerm_style.none
|
let error_style = ref LTerm_style.none
|
||||||
|
|
||||||
|
let autoload = ref true
|
||||||
|
|
|
@ -84,6 +84,7 @@ let load () =
|
||||||
| "" -> ()
|
| "" -> ()
|
||||||
| str -> raise (LTerm_resources.Error (Printf.sprintf "invalid profile %S" str)));
|
| str -> raise (LTerm_resources.Error (Printf.sprintf "invalid profile %S" str)));
|
||||||
UTop_private.error_style := styles.style_error;
|
UTop_private.error_style := styles.style_error;
|
||||||
|
UTop_private.autoload := LTerm_resources.get_bool "autoload" res <> Some false;
|
||||||
return ()
|
return ()
|
||||||
with
|
with
|
||||||
| Unix.Unix_error(Unix.ENOENT, _, _) ->
|
| Unix.Unix_error(Unix.ENOENT, _, _) ->
|
||||||
|
|
|
@ -18,3 +18,6 @@ quotation.foreground: x-purple
|
||||||
error.foreground: red
|
error.foreground: red
|
||||||
directive.foreground: x-lightsteelblue
|
directive.foreground: x-lightsteelblue
|
||||||
parenthesis.background: blue
|
parenthesis.background: blue
|
||||||
|
|
||||||
|
! uncomment the next line to disable autoload files
|
||||||
|
! autoload: false
|
||||||
|
|
|
@ -18,3 +18,6 @@ quotation.foreground: x-purple
|
||||||
error.foreground: red
|
error.foreground: red
|
||||||
directive.foreground: x-mediumorchid4
|
directive.foreground: x-mediumorchid4
|
||||||
parenthesis.background: light-blue
|
parenthesis.background: light-blue
|
||||||
|
|
||||||
|
! uncomment the next line to disable autoload files
|
||||||
|
! autoload: false
|
||||||
|
|
Loading…
Reference in New Issue