Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b51cb0d

Browse files
committedMar 7, 2025··
[#62] Define list thing to improve navigation in Emacs 31
If list thing is defined, Emacs 31 will set a few options automatically to improve navigation by lists/sexp etc. Big thanks for the patch to Juri Linkov <juri@linkov.net>.
1 parent e0703ff commit b51cb0d

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed
 

‎CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## main (unreleased)
44

5+
- [[#62](https://github.com/clojure-emacs/clojure-ts-mode/issues/62)]: Define `list` "thing" to improve navigation in Emacs 31.
6+
57
## 0.2.3 (2025-03-04)
68

79
- [#38]: Add support for `in-ns` forms in `clojure-ts-find-ns`.

‎clojure-ts-mode.el

+10-3
Original file line numberDiff line numberDiff line change
@@ -918,10 +918,16 @@ If JUSTIFY is non-nil, justify as well as fill the paragraph."
918918
"unquote_splicing_lit" "unquoting_lit")
919919
"A regular expression that matches nodes that can be treated as s-expressions.")
920920

921+
(defconst clojure-ts--list-nodes
922+
'("list_lit" "anon_fn_lit" "read_cond_lit" "splicing_read_cond_lit"
923+
"map_lit" "ns_map_lit" "vec_lit" "set_lit")
924+
"A regular expression that matches nodes that can be treated as lists.")
925+
921926
(defconst clojure-ts--thing-settings
922927
`((clojure
923-
(sexp ,(regexp-opt clojure-ts--sexp-nodes)
924-
text ,(regexp-opt '("comment"))))))
928+
(sexp ,(regexp-opt clojure-ts--sexp-nodes))
929+
(list ,(regexp-opt clojure-ts--list-nodes))
930+
(text ,(regexp-opt '("comment"))))))
925931

926932
(defvar clojure-ts-mode-map
927933
(let ((map (make-sparse-keymap)))
@@ -1043,7 +1049,8 @@ See `clojure-ts--font-lock-settings' for usage of MARKDOWN-AVAILABLE."
10431049
;; Workaround for treesit-transpose-sexps not correctly working with
10441050
;; treesit-thing-settings on Emacs 30.
10451051
;; Once treesit-transpose-sexps it working again this can be removed
1046-
(when (fboundp 'transpose-sexps-default-function)
1052+
(when (and (fboundp 'transpose-sexps-default-function)
1053+
(< emacs-major-version 31))
10471054
(setq-local transpose-sexps-function #'transpose-sexps-default-function)))))
10481055

10491056
;; For Emacs 30+, so that `clojure-ts-mode' is treated as deriving from

0 commit comments

Comments
 (0)
Please sign in to comment.