diff options
| author | Pierre-Marie Pédrot | 2014-11-14 16:36:14 +0100 |
|---|---|---|
| committer | Pierre-Marie Pédrot | 2014-11-15 18:28:33 +0100 |
| commit | 74234f18661a7ece3f5d141196a75784e3c7f6da (patch) | |
| tree | bcafc05041b97077fee508e81b9f2f8e156b357e | |
| parent | 9dcb23c2d7741b0fd9dbd8a568332dfc6362b5f1 (diff) | |
Plugging the color initialization in the Coqtop loop.
| -rw-r--r-- | toplevel/coqtop.ml | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/toplevel/coqtop.ml b/toplevel/coqtop.ml index 35d68603aa..01eaccd2bb 100644 --- a/toplevel/coqtop.ml +++ b/toplevel/coqtop.ml @@ -42,9 +42,33 @@ let print_header () = let warning s = msg_warning (strbrk s) let toploop = ref None -let toploop_init = ref (fun x -> - CoqworkmgrApi.(init !Flags.async_proofs_worker_priority); - x) + +let toploop_init = ref begin fun x -> + let () = + if + Terminal.has_style Unix.stdout && + Terminal.has_style Unix.stderr && + not (!Flags.print_emacs) + then begin + let colors = try Some (Sys.getenv "COQ_COLORS") with Not_found -> None in + match colors with + | None -> + (** Default colors *) + Ppstyle.init_color_output () + | Some "" -> + (** No color output *) + () + | Some s -> + (** Overwrite all colors *) + Ppstyle.clear_styles (); + Ppstyle.parse_config s; + Ppstyle.init_color_output () + end + in + let () = CoqworkmgrApi.(init !Flags.async_proofs_worker_priority) in + x + end + let toploop_run = ref (fun () -> if Dumpglob.dump () then begin if_verbose warning "Dumpglob cannot be used in interactive mode."; |
