2 require("interactive.js");
4 function define_global_mode(name, enable, disable)
6 var hyphen_name = name.replace("_","-","g");
7 var state = name + "_enabled";
9 var enable_hook_name = hyphen_name + "-enable-hook";
10 var disable_hook_name = hyphen_name + "-disable-hook";
11 define_hook(enable_hook_name);
12 define_hook(disable_hook_name);
13 var func = function (arg) {
14 var curstate = conkeror[state];
15 var newstate = (arg == null) ? !curstate : (arg > 0);
16 if (curstate == newstate)
18 conkeror[state] = newstate;
21 conkeror[enable_hook_name].run();
24 conkeror[disable_hook_name].run();
28 interactive(hyphen_name, function (I) {
30 func(arg && univ_arg_to_number(arg));
31 I.minibuffer.message(hyphen_name + (conkeror[state] ? " enabled" : " disabled"));
34 ignore_function_for_get_caller_source_code_reference("define_global_mode");