Module Ecaml.Position
A "position" is the index of a character in the text of a buffer. More precisely, a position identifies the place between two characters (or before the first character, or after the last character), so we can speak of the character before or after a given position. However, we often speak of the character "at" a position, meaning the character after that position.
Positions are usually represented as integers starting from 1, but can also be represented as "markers"--special objects that relocate automatically when text is inserted or deleted so they stay with the surrounding characters.
(Info-goto-node "(elisp)Positions")
.
include Ecaml__.Import.Value.Subtype
type value
type t
= private value
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 thanList.map symbols ~f:Symbol.to_value
.
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
val eq : t -> t -> bool
eq t1 t2 = Value.eq (to_value t1) (to_value t2)
, i.e.eq
checks whether the Emacs values underlyingt1
andt2
are physically equal. This is different thanphys_equal t1 t2
, because we don't always wrapeq
Emacs values inphys_equal
OCaml values. I.e.phys_equal t1 t2
implieseq t1 t2
, but not the converse.
val is_in_subtype : value -> bool
include Ecaml_value__.Valueable0.S with type t := t
val of_value_exn : Ecaml_value__.Value0.t -> t
val to_value : t -> Ecaml_value__.Value0.t
val type_ : t type_
val t : t type_
include Core_kernel.Comparable.S_plain with type t := t
include Core_kernel__.Comparable_intf.S_common
include Base.Comparable.S
include Base__.Comparable_intf.Polymorphic_compare
val ascending : t -> t -> int
ascending
is identical tocompare
.descending x y = ascending y x
. These are intended to be mnemonic when used likeList.sort ~compare:ascending
andList.sort ~cmp:descending
, since they cause the list to be sorted in ascending or descending order, respectively.
val descending : t -> t -> int
val between : t -> low:t -> high:t -> bool
between t ~low ~high
meanslow <= t <= high
val clamp_exn : t -> min:t -> max:t -> t
clamp_exn t ~min ~max
returnst'
, the closest value tot
such thatbetween t' ~low:min ~high:max
is true.Raises if
not (min <= max)
.
val clamp : t -> min:t -> max:t -> t Base.Or_error.t
include Base.Comparator.S with type t := t
val comparator : (t, comparator_witness) Base.Comparator.comparator
include Base__.Comparable_intf.Validate with type t := t
val validate_lbound : min:t Base.Maybe_bound.t -> t Base.Validate.check
val validate_ubound : max:t Base.Maybe_bound.t -> t Base.Validate.check
val validate_bound : min:t Base.Maybe_bound.t -> max:t Base.Maybe_bound.t -> t Base.Validate.check
module Replace_polymorphic_compare : Core_kernel__.Comparable_intf.Polymorphic_compare with type t := t
module Map : Core_kernel.Map.S_plain with type Key.t = t with type Key.comparator_witness = comparator_witness
module Set : Core_kernel.Set.S_plain with type Elt.t = t with type Elt.comparator_witness = comparator_witness
val of_int_exn : int -> t
val to_int : t -> int
val to_byte_position : t -> int
(describe-function 'position-bytes)
.(Info-goto-node "(elisp)Text Representations")
val of_byte_position : int -> t
(describe-function 'byte-to-position)
.(Info-goto-node "(elisp)Text Representations")