XEmacs -- Emacs: The Next Generation
     Searching XEmacs
Quick Links About XEmacs Getting XEmacs Customizing XEmacs Troubleshooting XEmacs Developing XEmacs

Syntax table improvements

Matt Tucker <tuck@whistlingfish.net>


The patch has been committed. It passes the old make check for syntax and regex, and several bugs have already been fixed.

Please test.


This patch ports (from GNU Emacs) support for the following features:

  1. A new text property 'syntax-table, which is one of:
    a syntax table

    Overrides the buffer's table when determining the syntax for this character.

    (syntax-code . matching-char)

    Specifies the syntax for this occurrence of the character. matching-char, if used, specifies the character returned by (matching-paren char). It can be excluded, in which case nil is returned.


    Equivalent to the property not existing: default to the buffer's syntax table.

  2. Two new syntax classes:
    generic comment delimiter

    Starts or ends a special kind of comment. Any generic comment delimiter matches any other comment delimiter, but not a comment starter or comment ender. Intended for use in the syntax-table text property.

    generic string delimiter

    Analogous to the generic comment delimiter, for strings.

These features can be used by modes which deal with files or text that have more sophisticated parsing requirements than XEmacs can usually handle.

A prime example (and in fact the only one I know) of such a mode would be cperl-mode (for Perl). Because Perl's syntax is so hairy, XEmacs has (until now) had a very difficult time dealing with Perl files, and required a lot of weird hacks to be able to indent and colorize them properly.

This patch bring XEmacs up to the level of GNU Emacs as regards its ability to handle Perl.

Open bugs


Other open issues

  • Syntax table cache lookup is not complete (although it's nearly so).


  • While a few spots still exist that bypass the syntax table cache lookup, the code is still completely usable. Also, since this really only affects buffers that make use of it, it shouldn't cause any problems for modes that don't use syntax-table properties.

Closed bugs



Conform with <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Automatically validated by PSGML