package ecaml

  1. Overview
  2. Docs
Module type
Class type

Ansi_color translates ANSI escape sequences to Emacs faces, like (find-library "ansi-color"). Ansi_color is significantly faster than ansi-color, especially on larger inputs.

val color_region_in_current_buffer : start:Position.t -> end_:Position.t -> ?use_temp_file:bool -> ?preserve_state:bool -> ?drop_unsupported_escapes:bool -> unit -> unit

color_region_in_current_buffer modifies the given region in the current buffer, deleting ANSI color escapes and applying their corresponding Emacs faces to the text they affect. use_temp_file = true can speed up coloring on large inputs but since it works by deleting and reinserting the region's text, it could drop existing text properties and markers in the region and maybe mess up the point. If use_temp_file = false then the point is preserved. If preserve_state is true, then the colorization state is preserved between calls, which is useful when buffers contain partial output (like in shell-mode), allowing colorization to continue where previous call left off.

val color_current_buffer : unit -> unit

color_current_buffer is similar to color_region_in_current_buffer where the region is the whole buffer but it always uses use_temp_file = true. Saving the buffer after calling color_current_buffer would save without the escapes, which is probably not desired, so color_current_buffer marks the buffer as not modified. It also turns off undo. After colorization point is set to the beginning of the buffer.

val max_supported_code : int
module Colors : sig ... end

(describe-variable 'ansi-color-names-vector. Colors uses the colors in ansi-colors-names-vector when translating ANSI color codes to faces.

val print_state_machine : bool Core.ref

print_state_machine = true causes color* functions to print_s the state machine used for coloring. This is used for testing.

val show_invalid_escapes : bool Customization.t

A customization variable governing whether invalid ANSI escape sequences are flagged in output.


Innovation. Community. Security.