Elisp: Create Syntax Table
Create Syntax Table
Here's typical way to create a syntax table.
;; typical way to create and set syntax table (defvar xx-syntax-table nil "Syntax table for `xx'.") (setq xx-syntax-table (let ((synTable (make-syntax-table))) ;; modify each char's class (modify-syntax-entry ?# "<" synTable) (modify-syntax-entry ?\n ">" synTable) ;; more here ;; return it synTable)) ;; set syntax table for the current buffer (set-syntax-table xx-syntax-table)
Modify Syntax Entry
modify-syntax-entry
-
(modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE)
modify a char's entry in a sytax table.
- CHAR is the Character Type
- NEWENTRY is the Syntax Descriptor
- SYNTAX-TABLE is a syntax table to modify. Defaults to the current buffer's syntax table.
Set Syntax Table to Buffer
set-syntax-table
-
(set-syntax-table TABLE)
set a syntax table for the current buffer.