aboutsummaryrefslogtreecommitdiff
path: root/printing/proof_diffs.ml
diff options
context:
space:
mode:
Diffstat (limited to 'printing/proof_diffs.ml')
-rw-r--r--printing/proof_diffs.ml28
1 files changed, 21 insertions, 7 deletions
diff --git a/printing/proof_diffs.ml b/printing/proof_diffs.ml
index 5aa7b3c7bd..d620e14a94 100644
--- a/printing/proof_diffs.ml
+++ b/printing/proof_diffs.ml
@@ -39,6 +39,13 @@ uses strikeout on removed text.
open Pp_diff
+let term_color = ref true
+
+let write_color_enabled enabled =
+ term_color := enabled
+
+let color_enabled () = !term_color
+
let diff_option = ref `OFF
let read_diffs_option () = match !diff_option with
@@ -46,11 +53,18 @@ let read_diffs_option () = match !diff_option with
| `ON -> "on"
| `REMOVED -> "removed"
-let write_diffs_option = function
-| "off" -> diff_option := `OFF
-| "on" -> diff_option := `ON
-| "removed" -> diff_option := `REMOVED
-| _ -> CErrors.user_err Pp.(str "Diffs option only accepts the following values: \"off\", \"on\", \"removed\".")
+let write_diffs_option opt =
+ let enable opt =
+ if not (color_enabled ()) then
+ CErrors.user_err Pp.(str "Enabling Diffs requires setting the \"-color\" command line argument to \"on\" or \"auto\".")
+ else
+ diff_option := opt
+ in
+ match opt with
+ | "off" -> diff_option := `OFF
+ | "on" -> enable `ON
+ | "removed" -> enable `REMOVED
+ | _ -> CErrors.user_err Pp.(str "Diffs option only accepts the following values: \"off\", \"on\", \"removed\".")
let () =
Goptions.(declare_string_option {
@@ -233,13 +247,13 @@ let process_goal sigma g : EConstr.t reified_goal =
{ name; ty; hyps; env; sigma };;
let pr_letype_core goal_concl_style env sigma t =
- Ppconstr.pr_lconstr_expr (Constrextern.extern_type goal_concl_style env sigma t)
+ Ppconstr.pr_lconstr_expr env sigma (Constrextern.extern_type goal_concl_style env sigma t)
let pp_of_type env sigma ty =
pr_letype_core true env sigma ty
let pr_leconstr_core goal_concl_style env sigma t =
- Ppconstr.pr_lconstr_expr (Constrextern.extern_constr goal_concl_style env sigma t)
+ Ppconstr.pr_lconstr_expr env sigma (Constrextern.extern_constr goal_concl_style env sigma t)
let pr_lconstr_env env sigma c = pr_leconstr_core false env sigma (EConstr.of_constr c)