From fafcf02c856ef8fd712ff75e8999dfb0f6d97f07 Mon Sep 17 00:00:00 2001 From: Kai Ma Date: Sun, 4 Dec 2022 06:15:42 +0800 Subject: [PATCH] Fix syntax tables of tree-sitter modes (bug#59807) Tree-sitter modes should use the same syntax table as the non-tree-sitter ones. * lisp/progmodes/js.el (js-mode-syntax-table) (js-ts-mode) * lisp/progmodes/python.el (python-ts-mode) * lisp/progmodes/sh-script.el (bash-ts-mode) Copyright-paperwork-exempt: yes xx --- lisp/progmodes/js.el | 3 ++- lisp/progmodes/python.el | 1 + lisp/progmodes/sh-script.el | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 1de0f3442f0..02990813ef4 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -686,7 +686,7 @@ This variable is like `sgml-attribute-offset'." (modify-syntax-entry ?$ "_" table) (modify-syntax-entry ?` "\"" table) table) - "Syntax table for `js-mode'.") + "Syntax table for `js-mode' and `js-ts-mode'.") (defvar-local js--quick-match-re nil "Autogenerated regexp used by `js-mode' to match buffer constructs.") @@ -3843,6 +3843,7 @@ Currently there are `js-mode' and `js-ts-mode'." \\" :group 'js + :syntax-table js-mode-syntax-table (when (treesit-ready-p 'javascript) ;; Borrowed from `js-mode'. (setq-local prettify-symbols-alist js--prettify-symbols-alist) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 0e0898ffe28..ee05862550d 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -6619,6 +6619,7 @@ implementations: `python-mode' and `python-ts-mode'." "Major mode for editing Python files, using tree-sitter library. \\{python-ts-mode-map}" + :syntax-table python-mode-syntax-table (when (treesit-ready-p 'python) (treesit-parser-create 'python) (setq-local treesit-font-lock-feature-list diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index e170d18afeb..76e8d5b0748 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1611,6 +1611,7 @@ with your script for an edit-interpret-debug cycle." "Major mode for editing Bash shell scripts. This mode automatically falls back to `sh-mode' if the buffer is not written in Bash or sh." + :syntax-table sh-mode-syntax-table (when (treesit-ready-p 'bash) (setq-local treesit-font-lock-feature-list '(( comment function) -- 2.39.2