Skip to content

set clojure-ts-align-forms-automatically not working when hit TAB in clojure-ts-clojurescript-mode #147

Description

@Jostar1024

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions