Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file value_intf.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330(** [Value.t] is the OCaml type corresponding to Emacs's universal type of values. It is
represented as an OCaml custom block ([emacs_value_ops] in [ecaml_stubs.c]) wrapped
around the [emacs_value] pointer type defined by the Emacs native-code module
interface, [emacs-module.h], available in Emacs 25 and beyond. This module has
low-level functions for working with Emacs values, OCaml wrappers that call the C
functions specified in [emacs-module.h]. All other calls from OCaml to Emacs are
built on top of this module. *)open!Core_kernelopen!ImportmoduletypeMake_subtype_arg=sigtypevaluevalhere:Source_code_position.tvalname:stringvalis_in_subtype:value->boolendmoduletypeFuncall=sigtypettypevaluevalfuncall0:t->valuevalfuncall1:t->value->valuevalfuncall2:t->value->value->valuevalfuncall3:t->value->value->value->valuevalfuncall4:t->value->value->value->value->valuevalfuncall5:t->value->value->value->value->value->valuevalfuncallN:t->valuelist->valuevalfuncallN_array:t->valuearray->valuevalfuncall0_i:t->unitvalfuncall1_i:t->value->unitvalfuncall2_i:t->value->value->unitvalfuncall3_i:t->value->value->value->unitvalfuncall4_i:t->value->value->value->value->unitvalfuncall5_i:t->value->value->value->value->value->unitvalfuncallN_i:t->valuelist->unitvalfuncallN_array_i:t->valuearray->unitvalfuncall_int_int_value_value_unit:t->int->int->value->value->unitvalfuncall_int_int_value_unit:t->int->int->value->unitendmoduletypeSubtype=sigtypevalue(** We expose [private value] for free identity conversions when the value is nested in
some covariant type, e.g. [(symbols : Symbol.t list :> Value.t list)] rather than
[List.map symbols ~f:Symbol.to_value]. *)typet=privatevalue[@@derivingsexp_of](** [eq t1 t2 = Value.eq (to_value t1) (to_value t2)], i.e. [eq] checks whether the
Emacs values underlying [t1] and [t2] are physically equal. This is different than
[phys_equal t1 t2], because we don't always wrap [eq] Emacs values in [phys_equal]
OCaml values. I.e. [phys_equal t1 t2] implies [eq t1 t2], but not the converse. *)valeq:t->t->boolvalis_in_subtype:value->boolincludeValueable0.Swithtypet:=tendmoduletypeType=sigtypevaluetype'atvalcreate:Sexp.t->('a->Sexp.t)->(value->'a)->('a->value)->'atvalwith_of_value_exn:'at->(value->'a)->'atvalto_sexp:'at->'a->Sexp.tvalbool:booltvalfloat:floattvalignored:unittvalint:inttvalstring:stringt(** [string_cached] is like [string], except it uses [of_utf8_bytes_cached]. *)valstring_cached:stringtvalunit:unittvalvalue:valuetvallist:'at->'alisttvalvector:'at->'aarrayt(** The representation of an option type's values in Elisp can be "wrapped" or
"unwrapped". In either case, [None] is represented as [nil]. The unrwapped
representation of [Some v] is the representation of [v], whereas the wrapped
representation is [cons v nil]. Wrapping is necessary if [nil] is a representation
of some value [v_nil], in order to distinguish between the representation of [None]
and [Some v_nil]. *)valoption:?wrapped:bool(** default is [false] *)->'at->'aoptiontvalalist:'at->'bt->('a*'b)listt(** Represent a tuple (a,b) as the elisp cons cell (a . b) *)valtuple:'at->'bt->('a*'b)t(** Represent a tuple (a,b) as the elisp list '(a b) *)valtuple2_as_list:'at->'bt->('a*'b)t(** Embed a sexpable ocaml type, so we can save values of the type in emacs, e.g. as
buffer local variables *)valsexpable:(moduleSexpablewithtypet='a)->name:Sexp.t->'at(** Embed values of type ['a]. Note that unlike other functions above, the values are
not transformed, so this can be used to preserve state in emacs. More precisely,
this following returns [true]:
{[
let var = Var.create (Value.Type.caml_embed type_id) in
Current_buffer.set_value var v;
phys_equal v (Current_buffer.value_exn var)
]}
*)valcaml_embed:'aType_equal.Id.t->'at(** A list of directories. Each element is a string (directory name) or nil (try
default directory). nil values are converted to ".", which has the same meaning.
*)valpath_list:stringlisttendmoduletypeEnum=sigtypet[@@derivingenumerate,sexp_of]endmoduletypeValue=sigtypet=Value0.t[@@derivingsexp_of]includeFuncallwithtypet:=twithtypevalue:=tvalintern:string->tvalnil:tvalt:tvallist:tlist->t(** [(describe-function 'cons)] *)valcons:t->t->t(** [(describe-function 'car)] *)valcar_exn:t->t(** [(describe-function 'cdr)] *)valcdr_exn:t->tvalto_list_exn:t->f:(t->'a)->'alistvalvector:tarray->tvalto_array_exn:t->f:(t->'a)->'aarrayvaloption:('a->t)->'aoption->tvaltype_of:t->t(** - [(Info-goto-node "(elisp)Type Predicates")] *)(** [(describe-function 'arrayp)] *)valis_array:t->bool(** [(describe-function 'bufferp)] *)valis_buffer:t->bool(** [(describe-function 'commandp)] *)valis_command:t->bool(** [(describe-function 'eventp)] *)valis_event:t->bool(** [(describe-function 'floatp)] *)valis_float:t->bool(** [(describe-function 'fontp)] *)valis_font:t->bool(** [(describe-function 'framep)] *)valis_frame:t->bool(** [(describe-function 'functionp)] *)valis_function:t->bool(** [(describe-function 'hash-table-p)] *)valis_hash_table:t->bool(** [(describe-function 'integerp)] *)valis_integer:t->bool(** [(describe-function 'keymapp)] *)valis_keymap:t->bool(** [(describe-function 'markerp)] *)valis_marker:t->bool(** [eq t nil] *)valis_nil:t->bool(** [(describe-function 'is-not-nil)] *)valis_not_nil:t->bool(** [(describe-function 'processp)] *)valis_process:t->bool(** [(describe-function 'stringp)] *)valis_string:t->bool(** [(describe-function 'symbolp)] *)valis_symbol:t->bool(** [(describe-function 'syntax-table-p)] *)valis_syntax_table:t->bool(** [(describe-function 'timerp)] *)valis_timer:t->bool(** [(describe-function 'vectorp)] *)valis_vector:t->bool(** [(describe-function 'windowp)] *)valis_window:t->bool(** [(describe-function 'window-configuration-p)] *)valis_window_configuration:t->bool(** [(describe-function 'consp)]
If supplied, [?car] and [?cdr] are additionally required to return true for the car
and cdr, respectively. *)valis_cons:?car:(t->bool)(** default: const true *)->?cdr:(t->bool)(** default: const true *)->t->boolvaleq:t->t->bool(** [(describe-function 'equal)] *)valequal:t->t->boolvalof_bool:bool->t(** [is_not_nil] *)valto_bool:t->bool(** [(describe-variable 'most-negative-fixnum)] *)valemacs_min_int:int(** [(describe-variable 'most-positive-fixnum)] *)valemacs_max_int:int(** [of_int_exn n] raises if [n] is not in the range [emacs_min_int, emacs_max_int] *)valof_int_exn:int->tvalto_int_exn:t->intvalof_float:float->tvalto_float_exn:t->floatvalof_utf8_bytes:string->t(** [of_utf8_bytes_cached] is like [of_utf8_bytes], except it keeps a hash table mapping
each OCaml string to the corresponding Elisp string. This can be used to optimize
the conversion of OCaml values to Elisp values. *)valof_utf8_bytes_cached:string->tvalto_utf8_bytes_exn:t->stringvalvec_get:t->int->tvalvec_set:t->int->t->unitvalvec_size:t->intvalinitialize_module:unitvalmessage:string->unitvalmessagef:('a,unit,string,unit)format4->'avalmessage_s:Sexp.t->unitvalprin1_to_string:t->string(** An ['a Type.t] is an isomorphism between ['a] and a subset of [Value.t]. *)moduleType:sigtypevaluetype'at={id:'aType_equal.Id.t;of_value_exn:value->'a;to_value:'a->value}[@@derivingfields,sexp_of]moduletypeS=Typewithtype'at:='atwithtypevalue:=valueincludeSvalname:_t->Sexp.tvalmap:'at->name:Sexp.t->of_:('a->'b)->to_:('b->'a)->'bt(** [map_id type_ name] is short for [map type_ ~name ~of_:Fn.id ~to_:Fn.id].
It is not interchangeable with [type_] itself. *)valmap_id:'at->Sexp.t->'atmoduletypeEnum=Enumvalenum:Sexp.t->(moduleEnumwithtypet='a)->('a->value)->'atendwithtypevalue:=tmoduletypeFuncall=Funcallwithtypevalue:=tmoduletypeMake_subtype_arg=Make_subtype_argwithtypevalue:=tmoduletypeSubtype=Subtypewithtypevalue:=twithtype'atype_:='aType.tmoduleMake_subtype(Subtype:Make_subtype_arg):SubtypemoduleExpert:sigvalhave_active_env:unit->boolvalraise_if_emacs_signaled:unit->unitvalnon_local_exit_signal:exn->unitendmoduleStat:sigtypet={emacs_free_performed:int;emacs_free_scheduled:int}[@@derivingsexp_of]valnow:unit->tvaldiff:t->t->tendmoduleFor_testing:sigexceptionElisp_signalof{symbol:t;data:t}(** Used to edit non-deterministic stuff out of Elisp signals. *)valmap_elisp_signal:(unit->'a)->f:(symbol:t->data:t->reraise:(symbol:t->data:t->Nothing.t)->Nothing.t)->'avalmap_elisp_signal_omit_data:(unit->'a)->'aendend