Module Ecaml.Text

Emacs text, which is a sequence of characters, along with text properties associated with each character.

(Info-goto-node "(elisp)Text")

include Value.Subtype
type value
type 'a type_
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 than List.map symbols ~f:Symbol.to_value.

include sig ... end
val sexp_of_t : t ‑> Sexplib.Sexp.t
val of_value_exn : value ‑> t
val to_value : t ‑> value
val eq : t ‑> t ‑> bool

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.

val type_ : t type_
val char_code : t ‑> int ‑> Char_code.t

(describe-function 'aref)(Info-goto-node "(elisp)String Basics")

val set_char_code : t ‑> int ‑> Char_code.t ‑> unit

(describe-function 'aset)(Info-goto-node "(elisp)String Basics")

val of_utf8_bytes : string ‑> t
val to_utf8_bytes : t ‑> string
val length : t ‑> int

length t returns the number of characters in t.

val num_bytes : t ‑> int

num_bytes t returns the number of bytes in the representation of t, which, if is_multibyte t, can be greater than length t. (describe-function 'string-bytes)

val concat : t list ‑> t

(describe-function 'concat)

module Face_spec : sig ... end

(Info-goto-node "(elisp)Special Properties")

module Property_name : sig ... end

(Info-goto-node "(elisp)Text Properties")

module Property : sig ... end

(Info-goto-node "(elisp)Text Properties")

val propertize : t ‑> Property.t list ‑> t

(describe-function 'propertize)(Info-goto-node "(elisp)Changing Properties")

val property_value : t ‑> at:int ‑> 'a Property_name.t ‑> 'a option

property_value t ~at property_name returns the value of property_name for the character after at. at is a zero-based index into t; property_value raises unless 0 <= at <= length t (allowing length is different than OCaml). (describe-function 'get-text-property)(Info-goto-node "(elisp)Examining Properties")

val properties : t ‑> at:int ‑> Property.t list

(describe-function 'text-properties-at)

val set_property : ?⁠start:int ‑> ?⁠end_:int ‑> t ‑> 'a Property_name.t ‑> 'a ‑> unit

(describe-function 'put-text-property)(Info-goto-node "(elisp)Changing Properties").

val set_properties : ?⁠start:int ‑> ?⁠end_:int ‑> t ‑> Property.t list ‑> unit

(describe-function 'set-text-properties)(Info-goto-node "(elisp)Changing Properties")

val add_properties : ?⁠start:int ‑> ?⁠end_:int ‑> t ‑> Property.t list ‑> unit

(describe-function 'add-text-properties)(Info-goto-node "(elisp)Changing Properties")

val remove_properties : ?⁠start:int ‑> ?⁠end_:int ‑> t ‑> Property_name.Packed.t list ‑> unit

(describe-function 'remove-list-of-text-properties)(Info-goto-node "(elisp)Changing Properties")

val is_multibyte : t ‑> bool

(describe-function 'multibyte-string-p)(Info-goto-node "(elisp)Text Representations")

val to_multibyte : t ‑> t

(describe-function 'string-to-multibyte)(Info-goto-node "(elisp)Converting Representations")

val to_unibyte_exn : t ‑> t

(describe-function 'string-to-unibyte)(Info-goto-node "(elisp)Converting Representations")