Expected behavior
- set
clojure-ts-align-forms-automatically to t.
- select the region of a map, hit TAB. The map is indented
;;before
(def my-map
{:a-key 1
:other-key 2})
;; after hitting TAB
(def my-map
{:a-key 1
:other-key 2})
Actual behavior
the map is not indented
Steps to reproduce the problem
- set
clojure-ts-align-forms-automatically to t.
- create a
core.cljs file, add the following content
(def my-map
{:a-key 1
:other-key 2})
- select the region of a map, hit TAB.
Environment & Version information
clojure-ts-mode version
clojure-ts-mode (version 0.6.0)
tree-sitter-clojure grammar version
unstable-20250526
Emacs version
GNU Emacs 30.2 (build 1, aarch64-apple-darwin24.6.0, NS appkit-2575.70 Version 15.7.5 (Build 24G624))
Operating system
MacOS 15.7.5 (24G624)
The issue I've found is that clojure-ts-clojurescript-mode calls (treesit-major-mode-setup) a second time
(when clojure-ts-clojurescript-use-js-parser is non-nil and the javascript
tree-sitter grammar is available), which resets indent-region-function back to
#'treesit-indent-region, overwriting the #'clojure-ts-indent-region that the
parent mode (clojure-ts-mode) set for automatic alignment.
I think jank-mode also has this issue. The simplest solution I think is to set indent-region-function after every (treesit-major-mode-setup), but would like to here what you think.
Expected behavior
clojure-ts-align-forms-automaticallytot.Actual behavior
the map is not indented
Steps to reproduce the problem
clojure-ts-align-forms-automaticallytot.core.cljsfile, add the following contentEnvironment & Version information
clojure-ts-mode version
clojure-ts-mode (version 0.6.0)
tree-sitter-clojure grammar version
unstable-20250526
Emacs version
GNU Emacs 30.2 (build 1, aarch64-apple-darwin24.6.0, NS appkit-2575.70 Version 15.7.5 (Build 24G624))
Operating system
MacOS 15.7.5 (24G624)
The issue I've found is that
clojure-ts-clojurescript-modecalls(treesit-major-mode-setup)a second time(when
clojure-ts-clojurescript-use-js-parseris non-nil and the javascripttree-sitter grammar is available), which resets
indent-region-functionback to#'treesit-indent-region, overwriting the#'clojure-ts-indent-regionthat theparent mode (
clojure-ts-mode) set for automatic alignment.clojure-ts-modeset the indent-region-functionhttps://github.com/clojure-emacs/clojure-ts-mode/blob/main/clojure-ts-mode.el#L3238-L3243
recall (treesit-major-mode-setup) in
clojure-ts-clojurescript-modehttps://github.com/clojure-emacs/clojure-ts-mode/blob/main/clojure-ts-mode.el#L3277-L3289
I think
jank-modealso has this issue. The simplest solution I think is to set indent-region-function after every(treesit-major-mode-setup), but would like to here what you think.