Elisp: How to Modify Syntax Table Temporarily
Here's a example of how to use a temporary syntax table just for 1 command.
Suppose, we want the curly quote “” to be considered as a bracket.
standard-syntax-table considers the curly quote as punctuation character.
(defun test () "move cursor to the right 1 char, but if it is a left curly quote, jump to the right curly quote. Version 2017-02-13" (interactive) (let (($temp-syn-table (make-syntax-table))) (modify-syntax-entry ?\“ "(”" $temp-syn-table) (modify-syntax-entry ?\” ")“" $temp-syn-table) (with-syntax-table $temp-syn-table (if (looking-at "\\s(") (forward-sexp 1) (right-char )))))
test “xyz” text
Writing Major Mode
- How to Write a Emacs Major Mode for Syntax Coloring
- Elisp: html6-mode
- Elisp: Font Lock Mode Basics
- Elisp: How to Define Face
- Elisp: How to Color Comment in Major Mode
- Elisp: How to Write Comment Command in Major Mode
- Elisp: How to Write Your Own Comment Command from Scratch
- Elisp: How to Write Keyword Completion Command
- Elisp: How to Create Keymap for Major Mode
- Elisp: Create Abbrev and Templates for Major Mode
- Elisp: Text Properties
- Elisp: Overlay Highlighting
- Emacs: Lookup Google, Dictionary, Documentation
- Elisp: Syntax Table Tutorial
Or Buy Xah Emacs Tutorial
Or buy a nice keyboard: Best Keyboard for Emacs
Ask me question on patreon