Function: copy-syntax-table

copy-syntax-table is a function defined in syntax.c.

Signature

(copy-syntax-table &optional TABLE)

Documentation

Construct a new syntax table and return it.

It is a copy of the TABLE, which defaults to the standard syntax table.

Probably introduced at or before Emacs version 17.

Source Code

// Defined in /usr/src/emacs/src/syntax.c
{
  Lisp_Object copy;

  if (!NILP (table))
    check_syntax_table (table);
  else
    table = Vstandard_syntax_table;

  copy = Fcopy_sequence (table);

  /* Only the standard syntax table should have a default element.
     Other syntax tables should inherit from parents instead.  */
  set_char_table_defalt (copy, Qnil);

  /* Copied syntax tables should all have parents.
     If we copied one with no parent, such as the standard syntax table,
     use the standard syntax table as the copy's parent.  */
  if (NILP (XCHAR_TABLE (copy)->parent))
    Fset_char_table_parent (copy, Vstandard_syntax_table);
  return copy;
}