From 93c82209374581ae0d52681d56a7dc28e8279f98 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Sat, 26 Nov 2022 15:05:57 -0800 Subject: [PATCH] Reorganize treesit-font-lock-feaure-list's to the new level scheme * lisp/progmodes/c-ts-mode.el (c-ts-mode--base-mode) * lisp/progmodes/csharp-mode.el (csharp-ts-mode) * lisp/progmodes/java-ts-mode.el (java-ts-mode) * lisp/progmodes/js.el (js-ts-mode) * lisp/progmodes/python.el (python-ts-mode) * lisp/progmodes/sh-script.el (bash-ts-mode) * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode): Reorganized treesit-font-lock-feature-list. --- lisp/progmodes/c-ts-mode.el | 8 ++++---- lisp/progmodes/csharp-mode.el | 7 ++++--- lisp/progmodes/java-ts-mode.el | 7 ++++--- lisp/progmodes/js.el | 7 ++++--- lisp/progmodes/python.el | 10 +++++----- lisp/progmodes/sh-script.el | 8 ++++---- lisp/progmodes/typescript-ts-mode.el | 7 ++++--- 7 files changed, 29 insertions(+), 25 deletions(-) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index fc35d9aedda..086257483e8 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -528,10 +528,10 @@ the subtrees." (setq-local which-func-functions nil) (setq-local treesit-font-lock-feature-list - '(( comment constant keyword literal preprocessor string) - ( assignment definition label property type) - ( delimiter error escape-sequence function - operator variable bracket)))) + '(( comment definition) + ( keyword preprocessor string type) + ( assignment constant escape-sequence label literal property ) + ( bracket delimiter error function operator variable)))) ;;;###autoload (define-derived-mode c-ts-mode c-ts-mode--base-mode "C" diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index a544a4b5cbd..d794bc854fe 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -974,9 +974,10 @@ Key bindings: ;; Font-lock. (setq-local treesit-font-lock-settings csharp-ts-mode--font-lock-settings) (setq-local treesit-font-lock-feature-list - '((comment keyword constant string) - (type definition expression literal attribute) - (bracket delimiter))) + '(( comment definition) + ( keyword string type) + ( attribute constant expression literal) + ( bracket delimiter))) ;; Imenu. (setq-local imenu-create-index-function #'csharp-ts-mode--imenu) diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el index ee2934f53c6..dd3d6d31e02 100644 --- a/lisp/progmodes/java-ts-mode.el +++ b/lisp/progmodes/java-ts-mode.el @@ -317,9 +317,10 @@ the subtrees." ;; Font-lock. (setq-local treesit-font-lock-settings java-ts-mode--font-lock-settings) (setq-local treesit-font-lock-feature-list - '((comment constant keyword string) - (annotation definition expression literal type) - (bracket delimiter operator))) + '(( comment definition ) + ( constant keyword string type) + ( annotation expression literal) + ( bracket delimiter operator))) ;; Imenu. (setq-local imenu-create-index-function #'java-ts-mode--imenu) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index da05b7b364a..f2016deb5d8 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3873,9 +3873,10 @@ Currently there are `js-mode' and `js-ts-mode'." (setq-local treesit-font-lock-settings js--treesit-font-lock-settings) (setq-local treesit-font-lock-feature-list '(( comment declaration) - ( constant expression identifier keyword number string) - ( bracket delimiter escape-sequence jsx operator - pattern property))) + ( keyword string) + ( constant escape-sequence expression + identifier jsx number pattern property) + ( bracket delimiter operator))) ;; Imenu (setq-local imenu-create-index-function #'js--treesit-imenu) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 9bbcac612fd..acfee211358 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -6615,11 +6615,11 @@ implementations: `python-mode' and `python-ts-mode'." (when (treesit-ready-p 'python) (treesit-parser-create 'python) (setq-local treesit-font-lock-feature-list - '(( comment string definition) - ( keyword builtin constant type) - ( assignment decorator escape-sequence - string-interpolation number property - operator bracket delimiter))) + '(( comment definition) + ( keyword string type) + ( assignment builtin constant decorator + escape-sequence number property string-interpolation ) + ( bracket delimiter operator))) (setq-local treesit-font-lock-settings python--treesit-settings) (setq-local imenu-create-index-function #'python-imenu-treesit-create-index) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 067aef86692..e11fb42fc88 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1608,10 +1608,10 @@ with your script for an edit-interpret-debug cycle." "Major mode for editing Bash shell scripts." (when (treesit-ready-p 'bash) (setq-local treesit-font-lock-feature-list - '(( comment function heredoc string) - ( command declaration-command keyword number variable) - ( bracket builtin-variable constant delimiter - misc-punctuation operator))) + '(( comment function) + ( command declaration-command keyword string) + ( builtin-variable constant heredoc number variable) + ( bracket delimiter misc-punctuation operator))) (setq-local treesit-font-lock-settings sh-mode--treesit-settings) (treesit-major-mode-setup))) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 763686bf660..c7b332c6149 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -320,9 +320,10 @@ ;; Font-lock. (setq-local treesit-font-lock-settings typescript-ts-mode--font-lock-settings) (setq-local treesit-font-lock-feature-list - '((comment declaration) - (constant expression identifier keyword number string) - (bracket delimiter jsx pattern property))) + '(( comment declaration) + ( keyword string) + ( constant expression identifier jsx number pattern property) + ( bracket delimiter))) ;; Imenu. (setq-local imenu-create-index-function #'js--treesit-imenu) -- 2.39.5