Hi
我在尝试安装grammar 但是失败了,是什么原因
ENV:
Emacs 30.2
tree-sitter: 0.23.0
RnE
2025 年10 月 29 日 15:04
2
应该是你 Emacs 链接的 treesitter 版本跟被用来编译 treesitter grammer 的 treesitter 不一致。
一般自己重新编译一下 Emacs 就好了
或者你也可以用 otool (Darwin) 或者 patchelf (unix) 纠正 Emacs 链接的 treesitter
hilde
2025 年10 月 29 日 20:33
4
也有可能是emacs 支持的值和treesit library HEAD 的 abi 版本不一致, 可以看看 (treesit-library-abi-version)
RnE
2025 年10 月 29 日 23:55
5
系统 treesitter 版本
用你的包管理器看。
Emacs treesitter 版本
macOS:
$ otool -L /Applications/Emacs.app/Contents/MacOS/Emacs | grep tree
return: /opt/pkg/lib/libtree-sitter.0.25.dylib (compatibility version 0.0.0, current version 0.0.0)
linux:
$ ldd `which emacs` | grep tree
如果一样,那就是 @hilde 提到的 ABI mismatch
grammer版本太新了与Emacs使用的libtree-sitter库版本mismatch了
尝试将libtree-sitter.so升级到0.25.9,(treesit-library-abi-version)返回15与grammer版本对应上就好了
或者降级下C grammer,https://github.com/tree-sitter/tree-sitter-c/releases下载个0.23.5版本就可以
已打开 05:16PM - 13 Oct 25 UTC
Emacs 30.1 only supports ABI 13 and 14, but multiple language libraries are now … at ABI 15 at head, resulting in `Warning (treesit): The installed language grammar for X cannot be located or has problems (version-mismatch): 15`.
So far I've been gradually updating `treesit-language-source-alist`, e.g.
```
(setq treesit-language-source-alist
'((bash . ("https://github.com/tree-sitter/tree-sitter-bash" "v0.23.3" nil nil nil))
(go . ("https://github.com/tree-sitter/tree-sitter-go" "v0.23.4" nil nil nil))
(gomod . ("https://github.com/camdencheek/tree-sitter-go-mod" "v1.0.2" nil nil nil))
(python . ("https://github.com/tree-sitter/tree-sitter-python" "v0.23.6" nil nil nil))))
```
But it would be nice if we could crowdsource determining the appropriate tags for each language library.
The first approach that occurs to me is adding a new `abi14_revision` key to the recipe function, encouraging the community to contribute values to that field in `treesit-auto.el`, and using that revision if `(treesit-library-abi-version)` returns 14.
Happy to help if that sounds like a good idea. I'm not attached to this specific approach.
1 个赞