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 -> 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. Ifuse_temp_file = false
then the point is preserved. Ifpreserve_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 tocolor_region_in_current_buffer
where the region is the whole buffer but it always usesuse_temp_file = true
. Saving the buffer after callingcolor_current_buffer
would save without the escapes, which is probably not desired, socolor_current_buffer
marks 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
.Colors
uses the colors inansi-colors-names-vector
when translating ANSI color codes to faces.
val print_state_machine : bool Core_kernel.ref
print_state_machine = true
causescolor*
functions toprint_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.