Keywords: xcoral

Next: Browser Up: Using Smac Previous: Regular expressions

# Color syntax highlighting

In every mode (i.e. built-in modes and user modes), keywords or expressions can be set off by colors with the following Smac function:

- void color_area(int start, int end, char *colorname);

  colors text region from positions start to end with the color colorname (see the standard X11 file rgb.txt).

This function can be used with the Smac regexp interface to color strings of your own modes (see color.sc §5.11 page ).

Example:

The colornames and the regular expressions are predefined in the file color.sc for the following modes: C, C++, Java, Latex, Html, Perl, Ada, Fortran, shell-script and Edir. The standards Makefile, makefile, and Imakefile can also be colored. You can modify them or add colors for your own mode.

Default key bindings are:

- Ctrl-x a colors buffer.

Attention When the current buffer has been modified by many operations, sometimes, colored strings do not match regular expressions nor keywords of the current mode and some lines are not displayed correctly. It is a display problem (the buffer is correct). In this case, use the Smac function remove_colors then color the buffer again else save and re-load the file.