Module Ecaml.Ansi_color
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 -> unitcolor_region_in_current_buffermodifies 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 = truecan 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. Ifuse_temp_file = falsethen the point is preserved. Ifpreserve_stateis 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 -> unitcolor_current_bufferis similar tocolor_region_in_current_bufferwhere the region is the whole buffer but it always usesuse_temp_file = true. Saving the buffer after callingcolor_current_bufferwould save without the escapes, which is probably not desired, socolor_current_buffermarks the buffer as not modified. It also turns off undo. After colorization point is set to the beginning of the buffer.
module Colors : sig ... end(describe-variable 'ansi-color-names-vector.Colorsuses the colors inansi-colors-names-vectorwhen translating ANSI color codes to faces.
val print_state_machine : bool Core_kernel.refprint_state_machine = truecausescolor*functions toprint_sthe state machine used for coloring. This is used for testing.
val show_invalid_escapes : bool Customization.tA customization variable governing whether invalid ANSI escape sequences are flagged in output.