我目前使用的是 emacs-plus 30, 这个是最小配置
(add-to-list 'treesit-extra-load-path (expand-file-name "tree-sitter/" user-emacs-directory))
(add-to-list 'load-path "~/.emacs.d/site-lisp/clojure-ts-mode")
(require 'clojure-ts-mode)
;; debug
(setq debug-on-quit t)
clone clojure-ts-mode
cd ~/.emacs.d/site-lisp
git clone https://github.com/clojure-emacs/clojure-ts-mode.git
然后打开我的这个 clj 文件,移动到 57 行,输入下面的字符
(comment
然后就卡住了,CPU飙升到100%,这种复现方式必现
lldb -p $(ps aux | grep '[E]macs' | awk '{print $2}')
(lldb) process attach --pid 39212
Process 39212 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
frame #0: 0x0000000104fd00a8 libtree-sitter.0.23.dylib`ts_subtree_summarize_children + 1388
libtree-sitter.0.23.dylib`ts_subtree_summarize_children:
-> 0x104fd00a8 <+1388>: cbz w8, 0x104fd00b4 ; <+1400>
0x104fd00ac <+1392>: add w8, w8, #0x1
0x104fd00b0 <+1396>: b 0x104fd00b8 ; <+1404>
0x104fd00b4 <+1400>: mov w8, #0x1 ; =1
Executable module set to "/opt/homebrew/Cellar/emacs-plus@30/30.0.60/Emacs.app/Contents/MacOS/Emacs".
Architecture set to: arm64-apple-macosx-.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
* frame #0: 0x0000000104fd00a8 libtree-sitter.0.23.dylib`ts_subtree_summarize_children + 1388
frame #1: 0x0000000104fd0260 libtree-sitter.0.23.dylib`ts_subtree_new_node + 388
frame #2: 0x0000000104fd49dc libtree-sitter.0.23.dylib`ts_parser__reduce + 300
frame #3: 0x0000000104fc56e8 libtree-sitter.0.23.dylib`ts_parser_parse + 5204
frame #4: 0x00000001045644c8 Emacs`Ftreesit_parser_root_node + 236
frame #5: 0x00000001044e5ad4 Emacs`funcall_subr + 288
frame #6: 0x00000001044e0378 Emacs`Ffuncall + 412
frame #7: 0x00000001044f2cc8 Emacs`mapcar1 + 652
frame #8: 0x00000001044f2e18 Emacs`Fmapcar + 220
frame #9: 0x00000001044e5a1c Emacs`funcall_subr + 104
frame #10: 0x000000010452c9fc Emacs`exec_byte_code + 2180
frame #11: 0x00000001044e0378 Emacs`Ffuncall + 412
frame #12: 0x00000001044e5364 Emacs`Frun_hook_wrapped + 224
frame #13: 0x00000001044e5a1c Emacs`funcall_subr + 104
frame #14: 0x000000010452c9fc Emacs`exec_byte_code + 2180
frame #15: 0x00000001044e0378 Emacs`Ffuncall + 412
frame #16: 0x00000001044e2dcc Emacs`internal_condition_case_n + 120
frame #17: 0x00000001043a42e0 Emacs`dsafe_call1 + 160
frame #18: 0x00000001043ab4f0 Emacs`handle_fontified_prop + 716
frame #19: 0x00000001043a9c58 Emacs`handle_stop + 112
frame #20: 0x00000001043a8a34 Emacs`next_element_from_buffer + 248
frame #21: 0x000000010439b374 Emacs`get_next_display_element + 140
frame #22: 0x00000001043bc6a4 Emacs`display_line + 1120
frame #23: 0x00000001043c5b58 Emacs`redisplay_window + 13536
frame #24: 0x00000001043c0468 Emacs`redisplay_window_1 + 44
frame #25: 0x00000001044e2c90 Emacs`internal_condition_case_1 + 100
frame #26: 0x00000001043b98b0 Emacs`redisplay_internal + 4216
frame #27: 0x000000010445b0c4 Emacs`read_char + 3212
frame #28: 0x00000001044581e8 Emacs`read_key_sequence + 1388
frame #29: 0x0000000104456a38 Emacs`command_loop_1 + 864
frame #30: 0x00000001044e2c04 Emacs`internal_condition_case + 96
frame #31: 0x0000000104455c50 Emacs`command_loop_2 + 52
frame #32: 0x00000001044e232c Emacs`internal_catch + 88
frame #33: 0x00000001045c40a0 Emacs`command_loop.cold.1 + 88
frame #34: 0x0000000104455c1c Emacs`command_loop + 156
frame #35: 0x0000000104455acc Emacs`recursive_edit_1 + 168
frame #36: 0x00000001044561b0 Emacs`Frecursive_edit + 388
frame #37: 0x0000000104454c00 Emacs`main + 8416
frame #38: 0x000000019aca0274 dyld`start + 2840
(lldb)
我测试过emacs-plus 29 没这个问题,emacs-30、emacs-31 都有这个问题,目前用的30的commit 是 89c99891b2b3ab087cd7e824cef391ef26800ab4,也是最近几天的 还测试过 Emacs For Mac OS X: Releases, Pretests & Nightlies 这里的30 的版本,也存在这个问题