Skip to content

Commit bec7871

Browse files
committed
Make the mode setup a bit more structured
1 parent b01c20a commit bec7871

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

clojure-ts-mode.el

+17-8
Original file line numberDiff line numberDiff line change
@@ -983,8 +983,15 @@ If JUSTIFY is non-nil, justify as well as fill the paragraph."
983983
See `clojure-ts--font-lock-settings' for usage of MARKDOWN-AVAILABLE."
984984
(setq-local comment-add 1)
985985
(setq-local comment-start ";")
986+
986987
(setq-local treesit-font-lock-settings
987988
(clojure-ts--font-lock-settings markdown-available))
989+
(setq-local treesit-font-lock-feature-list
990+
'((comment definition variable)
991+
(keyword string char symbol builtin type)
992+
(constant number quote metadata doc)
993+
(bracket deref function regex tagged-literals)))
994+
988995
(setq-local treesit-defun-prefer-top-level t)
989996
(setq-local treesit-defun-tactic 'top-level)
990997
(setq-local treesit-defun-type-regexp
@@ -995,18 +1002,16 @@ See `clojure-ts--font-lock-settings' for usage of MARKDOWN-AVAILABLE."
9951002
(lambda (node)
9961003
(or (not clojure-ts-toplevel-inside-comment-form)
9971004
(not (clojure-ts--definition-node-p "comment" node))))))
998-
(setq-local treesit-simple-indent-rules
999-
(clojure-ts--configured-indent-rules))
10001005
(setq-local treesit-defun-name-function
10011006
#'clojure-ts--standard-definition-node-name)
1007+
1008+
(setq-local treesit-simple-indent-rules
1009+
(clojure-ts--configured-indent-rules))
1010+
(setq-local fill-paragraph-function #'clojure-ts--fill-paragraph)
1011+
10021012
(setq-local treesit-simple-imenu-settings
10031013
clojure-ts--imenu-settings)
1004-
(setq-local treesit-font-lock-feature-list
1005-
'((comment definition variable)
1006-
(keyword string char symbol builtin type)
1007-
(constant number quote metadata doc)
1008-
(bracket deref function regex tagged-literals)))
1009-
(setq-local fill-paragraph-function #'clojure-ts--fill-paragraph)
1014+
10101015
(when (boundp 'treesit-thing-settings) ;; Emacs 30+
10111016
(setq-local treesit-thing-settings clojure-ts--thing-settings)))
10121017

@@ -1022,15 +1027,19 @@ See `clojure-ts--font-lock-settings' for usage of MARKDOWN-AVAILABLE."
10221027
(when use-markdown-inline
10231028
(treesit-parser-create 'markdown_inline)
10241029
(setq-local treesit-range-settings clojure-ts--treesit-range-settings))
1030+
10251031
(when (treesit-ready-p 'clojure)
10261032
(treesit-parser-create 'clojure)
10271033
(clojure-ts-mode-variables use-markdown-inline)
1034+
10281035
(when clojure-ts--debug
10291036
(setq-local treesit--indent-verbose t)
10301037
(when (eq clojure-ts--debug 'font-lock)
10311038
(setq-local treesit--font-lock-verbose t))
10321039
(treesit-inspect-mode))
1040+
10331041
(treesit-major-mode-setup)
1042+
10341043
;; Workaround for treesit-transpose-sexps not correctly working with
10351044
;; treesit-thing-settings on Emacs 30.
10361045
;; Once treesit-transpose-sexps it working again this can be removed

0 commit comments

Comments
 (0)