Function: modify-syntax-entry

modify-syntax-entry is an interactive function defined in syntax.c.

Signature

(modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE)

Documentation

Set syntax for character CHAR according to string NEWENTRY.

The syntax is changed only for table SYNTAX-TABLE, which defaults to
 the current buffer's syntax table.
CHAR may be a cons (MIN . MAX), in which case, syntaxes of all characters in the range MIN to MAX are changed. The first character of NEWENTRY should be one of the following:
  Space or - whitespace syntax. w word constituent.
  _ symbol constituent. . punctuation.
  ( open-parenthesis. ) close-parenthesis.
  " string quote. \ escape.
  $ paired delimiter. ' expression quote or prefix operator.
  < comment starter. > comment ender.
  / character-quote. @ inherit from parent table.
  | generic string fence. ! generic comment fence.

Only single-character comment start and end sequences are represented thus. Two-character sequences are represented as described below. The second character of NEWENTRY is the matching parenthesis,
 used only if the first character is ( or ).
Any additional characters are flags. Defined flags are the characters 1, 2, 3, 4, b, p, and n.
 1 means CHAR is the start of a two-char comment start sequence.
 2 means CHAR is the second character of such a sequence.
 3 means CHAR is the start of a two-char comment end sequence.
 4 means CHAR is the second character of such a sequence.

There can be several orthogonal comment sequences. This is to support language modes such as C++. By default, all comment sequences are of style a, but you can set the comment sequence style to b (on the second character of a comment-start, and the first character of a comment-end sequence) and/or c (on any of its chars) using this flag:
 b means CHAR is part of comment sequence b.
 c means CHAR is part of comment sequence c.
 n means CHAR is part of a nestable comment sequence.

 p means CHAR is a prefix character for backward-prefix-chars;
   such characters are treated as whitespace when they occur
   between expressions.

View in manual

Probably introduced at or before Emacs version 17.

Key Bindings

Source Code

// Defined in /usr/src/emacs/src/syntax.c
{
  if (CONSP (c))
    {
      CHECK_CHARACTER_CAR (c);
      CHECK_CHARACTER_CDR (c);
    }
  else
    CHECK_CHARACTER (c);

  if (NILP (syntax_table))
    syntax_table = BVAR (current_buffer, syntax_table);
  else
    check_syntax_table (syntax_table);

  newentry = Fstring_to_syntax (newentry);
  if (CONSP (c))
    SET_RAW_SYNTAX_ENTRY_RANGE (syntax_table, c, newentry);
  else
    SET_RAW_SYNTAX_ENTRY (syntax_table, XFIXNUM (c), newentry);

  /* We clear the regexp cache, since character classes can now have
     different values from those in the compiled regexps.*/
  clear_regexp_cache ();

  return Qnil;
}