-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Opening a clojure file with the following function in clojure-ts-mode:
(defn unescape
[s]
(-> s
(string/replace "&" "&")
(string/replace "*" "*")
(string/replace "^" "^")
(string/replace "_" "_")
(string/replace "~" "~")
(string/replace "<" "<")
(string/replace ">" ">")
(string/replace "[" "[")
(string/replace "]" "]")
(string/replace "(" "(")
(string/replace ")" ")")
(string/replace """ "\"")))..causes emacs to hang for over 10 minutes. Any attempt to edit the file once emacs has sprung back to life will cause another 10+ minutes of waiting. During these 10 minutes I can see emacs saturating a CPU core.
I have reproduced this with a minimal project containing just one file with just this one function, and with a stripped down emacs init.el just containing:
(package-install 'clojure-ts-mode)
(use-package clojure-ts-mode)Interestingly clojure-ts-mode seems to be perfectly ok with the following rewrite:
(defn unescape
[s]
(string/replace s #"&|*|^|_|~|<|>|[|]|(|)|""
{"&" "&"
"*" "*"
"^" "^"
"_" "_"
"~" "~"
"<" "<"
">" ">"
"[" "["
"]" "]"
"(" "("
")" ")"
""" "\""}))Expected behavior
File opens fine, like it does in clojure-mode
Actual behavior
Emacs hangs
Steps to reproduce the problem
Put above function into a file and open it in clojure-ts-mode
clojure-ts-mode version
0.5.1
tree-sitter-clojure grammar version
unstable-20250526 (the version emacs installs when starting clojure-ts-mode)
Emacs version
30.2
Operating system
Arch Linux
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working