src/Pure/ProofGeneral/preferences.ML
author haftmann
Mon, 22 Sep 2008 13:56:04 +0200
changeset 28315 d3cf88fe77bc
parent 28066 611e504c1191
child 28587 52ec4c827ed4
permissions -rw-r--r--
generic quickcheck framework
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
     1
(*  Title:      Pure/ProofGeneral/preferences.ML
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
     2
    ID:         $Id$
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
     3
    Author:     David Aspinall and Markus Wenzel
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
     4
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
     5
User preferences for Isabelle which are maintained by the interface.
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
     6
*)
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
     7
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
     8
signature PREFERENCES =
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
     9
sig
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    10
  type pgiptype = PgipTypes.pgiptype
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    11
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    12
  type isa_preference = { name: string,
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    13
                          descr: string,
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    14
                          default: string,
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    15
                          pgiptype: pgiptype,
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    16
                          get: unit -> string,
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    17
                          set: string -> unit }
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    18
24191
333f0a4bcc55 Typo in comment
aspinall
parents: 24100
diff changeset
    19
  (* table of categories and preferences; names must be unique *)
22214
6e9ab159512f Add operations on preference tables (remove, set_default).
aspinall
parents: 22130
diff changeset
    20
  type isa_preference_table = (string * isa_preference list) list
6e9ab159512f Add operations on preference tables (remove, set_default).
aspinall
parents: 22130
diff changeset
    21
6e9ab159512f Add operations on preference tables (remove, set_default).
aspinall
parents: 22130
diff changeset
    22
  val preferences : isa_preference_table
6e9ab159512f Add operations on preference tables (remove, set_default).
aspinall
parents: 22130
diff changeset
    23
6e9ab159512f Add operations on preference tables (remove, set_default).
aspinall
parents: 22130
diff changeset
    24
  val remove      : string -> isa_preference_table -> isa_preference_table
28066
611e504c1191 extended interface to preferences to allow adding new ones
nipkow
parents: 25440
diff changeset
    25
  val add         : string -> isa_preference
611e504c1191 extended interface to preferences to allow adding new ones
nipkow
parents: 25440
diff changeset
    26
                    -> isa_preference_table -> isa_preference_table
22214
6e9ab159512f Add operations on preference tables (remove, set_default).
aspinall
parents: 22130
diff changeset
    27
  val set_default : string * string -> isa_preference_table -> isa_preference_table
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    28
end
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    29
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    30
structure Preferences : PREFERENCES =
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    31
struct
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    32
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    33
val thm_depsN = "thm_deps";    (* also in proof_general_pgip.ML: move to pgip_isabelle? *)
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    34
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    35
type pgiptype = PgipTypes.pgiptype
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    36
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    37
type isa_preference = { name: string,
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    38
                        descr: string,
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    39
                        default: string,
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    40
                        pgiptype: pgiptype,
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    41
                        get: unit -> string,
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    42
                        set: string -> unit }
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    43
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    44
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    45
fun mkpref get set typ nm descr =
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    46
    { name=nm, descr=descr, pgiptype=typ, get=get, set=set, default=get() } : isa_preference
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    47
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    48
fun mkpref_from_ref read write typ r nm descr =
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    49
    mkpref (fn()=> read (!r)) (fn v=> r:= (write v)) typ nm descr
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    50
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    51
val int_pref =
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    52
    mkpref_from_ref PgipTypes.int_to_pgstring (PgipTypes.read_pgipint (NONE,NONE))
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    53
                    (PgipTypes.Pgipint (NONE, NONE))
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    54
val nat_pref =
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    55
    mkpref_from_ref PgipTypes.int_to_pgstring PgipTypes.read_pgipnat PgipTypes.Pgipnat
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    56
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    57
val bool_pref =
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    58
    mkpref_from_ref PgipTypes.bool_to_pgstring PgipTypes.read_pgipbool PgipTypes.Pgipbool
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    59
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    60
val proof_pref =
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    61
    let
25223
7463251e7273 qualified Proofterm.proofs;
wenzelm
parents: 24806
diff changeset
    62
        fun get () = PgipTypes.bool_to_pgstring (! Proofterm.proofs >= 2)
7463251e7273 qualified Proofterm.proofs;
wenzelm
parents: 24806
diff changeset
    63
        fun set s = Proofterm.proofs := (if PgipTypes.read_pgipbool s then 2 else 1)
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    64
    in
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    65
        mkpref get set PgipTypes.Pgipbool "full-proofs"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    66
               "Record full proof objects internally"
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    67
    end
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    68
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    69
val thm_deps_pref =
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    70
    let
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    71
        fun get () = PgipTypes.bool_to_pgstring (print_mode_active thm_depsN)
24614
a4b2eb0dd673 change print_mode: CRITICAL;
wenzelm
parents: 24454
diff changeset
    72
        fun set s =  NAMED_CRITICAL "print_mode" (fn () =>
a4b2eb0dd673 change print_mode: CRITICAL;
wenzelm
parents: 24454
diff changeset
    73
          if PgipTypes.read_pgipbool s then
a4b2eb0dd673 change print_mode: CRITICAL;
wenzelm
parents: 24454
diff changeset
    74
            change print_mode (insert (op =) thm_depsN)
a4b2eb0dd673 change print_mode: CRITICAL;
wenzelm
parents: 24454
diff changeset
    75
          else
a4b2eb0dd673 change print_mode: CRITICAL;
wenzelm
parents: 24454
diff changeset
    76
            change print_mode (remove (op =) thm_depsN))
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    77
    in
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    78
        mkpref get set PgipTypes.Pgipbool "theorem-dependencies"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    79
               "Track theorem dependencies within Proof General"
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    80
    end
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    81
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    82
val print_depth_pref =
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    83
    let
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    84
        fun get () = PgipTypes.int_to_pgstring (get_print_depth ())
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    85
        val set = print_depth o PgipTypes.read_pgipnat
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    86
    in
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    87
        mkpref get set PgipTypes.Pgipnat
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    88
               "print-depth" "Setting for the ML print depth"
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    89
    end
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    90
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    91
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    92
val display_preferences =
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    93
    [bool_pref show_types
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    94
               "show-types"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    95
               "Include types in display of Isabelle terms",
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    96
     bool_pref show_sorts
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    97
               "show-sorts"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
    98
               "Include sorts in display of Isabelle terms",
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
    99
     bool_pref show_consts
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   100
               "show-consts"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   101
               "Show types of consts in Isabelle goal display",
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   102
     bool_pref long_names
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   103
               "long-names"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   104
               "Show fully qualified names in Isabelle terms",
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   105
     bool_pref show_brackets
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   106
               "show-brackets"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   107
               "Show full bracketing in Isabelle terms",
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   108
     bool_pref Proof.show_main_goal
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   109
               "show-main-goal"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   110
               "Show main goal in proof state display",
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   111
     bool_pref Syntax.eta_contract
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   112
               "eta-contract"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   113
               "Print terms eta-contracted"]
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   114
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   115
val advanced_display_preferences =
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   116
    [nat_pref goals_limit
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   117
              "goals-limit"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   118
              "Setting for maximum number of goals printed",
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   119
     int_pref ProofContext.prems_limit
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   120
              "prems-limit"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   121
              "Setting for maximum number of premises printed",
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   122
     print_depth_pref,
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   123
     bool_pref show_question_marks
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   124
               "show-question-marks"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   125
               "Show leading question mark of variable name"]
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   126
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   127
val tracing_preferences =
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   128
    [bool_pref trace_simp
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   129
               "trace-simplifier"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   130
               "Trace simplification rules.",
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   131
     nat_pref trace_simp_depth_limit
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   132
              "trace-simplifier-depth"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   133
              "Trace simplifier depth limit.",
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   134
     bool_pref trace_rules
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   135
               "trace-rules"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   136
               "Trace application of the standard rules",
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   137
     bool_pref Pattern.trace_unify_fail
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   138
               "trace-unification"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   139
               "Output error diagnostics during unification",
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   140
     bool_pref Output.timing
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   141
               "global-timing"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   142
               "Whether to enable timing in Isabelle.",
22130
0906fd95e0b5 Output.debug: non-strict;
wenzelm
parents: 21940
diff changeset
   143
     bool_pref Toplevel.debug
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   144
                "debugging"
24454
692dac1e7381 - new auto-quickcheck flag
berghofe
parents: 24329
diff changeset
   145
                "Whether to enable debugging.",
28315
d3cf88fe77bc generic quickcheck framework
haftmann
parents: 28066
diff changeset
   146
     bool_pref Quickcheck.auto
24454
692dac1e7381 - new auto-quickcheck flag
berghofe
parents: 24329
diff changeset
   147
                "auto-quickcheck"
24806
c070cd2a1450 added auto-quickcheck-time-limit;
wenzelm
parents: 24614
diff changeset
   148
                "Whether to enable quickcheck automatically.",
28315
d3cf88fe77bc generic quickcheck framework
haftmann
parents: 28066
diff changeset
   149
     nat_pref Quickcheck.auto_time_limit
24806
c070cd2a1450 added auto-quickcheck-time-limit;
wenzelm
parents: 24614
diff changeset
   150
                "auto-quickcheck-time-limit"
25440
aa25d4d59383 Add thm_dep preference to menu, inadvertently missed off
aspinall
parents: 25223
diff changeset
   151
                "Time limit for automatic quickcheck (in milliseconds).",
aa25d4d59383 Add thm_dep preference to menu, inadvertently missed off
aspinall
parents: 25223
diff changeset
   152
     thm_deps_pref]
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   153
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   154
val proof_preferences =
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   155
    [bool_pref quick_and_dirty
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   156
               "quick-and-dirty"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   157
               "Take a few short cuts",
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   158
     bool_pref Toplevel.skip_proofs
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   159
               "skip-proofs"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   160
               "Skip over proofs (interactive-only)",
24454
692dac1e7381 - new auto-quickcheck flag
berghofe
parents: 24329
diff changeset
   161
     proof_pref,
24100
a2f19514e156 added max-threads preference;
wenzelm
parents: 22587
diff changeset
   162
     nat_pref Multithreading.max_threads
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   163
               "max-threads"
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   164
               "Maximum number of threads"]
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   165
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   166
val preferences =
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   167
    [("Display", display_preferences),
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   168
     ("Advanced Display", advanced_display_preferences),
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   169
     ("Tracing", tracing_preferences),
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   170
     ("Proof", proof_preferences)]
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   171
22214
6e9ab159512f Add operations on preference tables (remove, set_default).
aspinall
parents: 22130
diff changeset
   172
type isa_preference_table = (string * isa_preference list) list
6e9ab159512f Add operations on preference tables (remove, set_default).
aspinall
parents: 22130
diff changeset
   173
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   174
fun remove name (preftable : isa_preference_table)  =
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   175
    map (fn (cat,prefs) =>
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   176
            (cat, filter_out (curry op= name o #name) prefs))
22214
6e9ab159512f Add operations on preference tables (remove, set_default).
aspinall
parents: 22130
diff changeset
   177
        preftable;
6e9ab159512f Add operations on preference tables (remove, set_default).
aspinall
parents: 22130
diff changeset
   178
24329
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   179
fun set_default (setname,newdefault) (preftable : isa_preference_table)  =
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   180
    map (fn (cat,prefs) =>
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   181
            (cat, map (fn (pref as {name,descr,default,pgiptype,get,set})
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   182
                          => if (name = setname) then
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   183
                                 (set newdefault;
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   184
                                  {name=name,descr=descr,default=newdefault,
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   185
                                  pgiptype=pgiptype,get=get,set=set})
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   186
                             else pref)
f31594168d27 ML system provides get_print_depth;
wenzelm
parents: 24191
diff changeset
   187
                  prefs))
22214
6e9ab159512f Add operations on preference tables (remove, set_default).
aspinall
parents: 22130
diff changeset
   188
        preftable;
6e9ab159512f Add operations on preference tables (remove, set_default).
aspinall
parents: 22130
diff changeset
   189
28066
611e504c1191 extended interface to preferences to allow adding new ones
nipkow
parents: 25440
diff changeset
   190
fun add cname (pref: isa_preference) (preftable : isa_preference_table) =
611e504c1191 extended interface to preferences to allow adding new ones
nipkow
parents: 25440
diff changeset
   191
    map (fn (cat,prefs:isa_preference list) =>
611e504c1191 extended interface to preferences to allow adding new ones
nipkow
parents: 25440
diff changeset
   192
      if cat <> cname then (cat,prefs)
611e504c1191 extended interface to preferences to allow adding new ones
nipkow
parents: 25440
diff changeset
   193
      else if (#name pref) mem (map #name prefs)
611e504c1191 extended interface to preferences to allow adding new ones
nipkow
parents: 25440
diff changeset
   194
           then error ("Preference already exists: " ^ quote(#name pref))
611e504c1191 extended interface to preferences to allow adding new ones
nipkow
parents: 25440
diff changeset
   195
           else (cat, pref::prefs))  preftable;
611e504c1191 extended interface to preferences to allow adding new ones
nipkow
parents: 25440
diff changeset
   196
21637
a7b156c404e2 Revamped Proof General interface.
aspinall
parents:
diff changeset
   197
end