1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
open! Core_kernel
open! Import
module Current_buffer = Current_buffer0
module Q = struct
let evil = "evil" |> Symbol.intern
let evilified = "evilified" |> Symbol.intern
end
let evil_declare_ignore_repeat =
Funcall.("evil-declare-ignore-repeat" <: Symbol.t @-> return ignored)
;;
let declare_ignore_repeat command =
Eval.after_load [%here] Q.evil ~f:(fun () -> evil_declare_ignore_repeat command)
;;
module Config = struct
type one = Ignore_repeat
type t = one list
let apply_one command = function
| Ignore_repeat -> declare_ignore_repeat command
;;
let apply_to_defun t command = List.iter t ~f:(apply_one command)
end
module State = struct
type t =
| Evilified
| Other of Symbol.t
[@@deriving equal, sexp_of]
let type_ =
Value.Type.map
Symbol.t
~name:[%sexp "evil-state"]
~of_:(fun sym -> if Symbol.equal Q.evilified sym then Evilified else Other sym)
~to_:(function
| Evilified -> Q.evilified
| Other sym -> sym)
;;
let t = type_
let var = Var.Wrap.("evil-state" <: t)
let get () = Current_buffer.value_exn var
end
module Escape = struct
let inhibit_functions = Var.Wrap.("evil-escape-inhibit-functions" <: list Function.t)
end