emacs

pieterbreed 2026-04-21T07:24:47.059559Z

Is anyone else having treesitter errors when opening clojure files in emacs recently? (last day or three) I did an update of my OS (Omarchy), I believe the treesitter lib was updated. Today when I opened a clojure project, the treesitter integration is broken. I updated all of the elisp packages, but still not working. I'll paste the actual error in the thread.

pieterbreed 2026-04-21T07:25:01.206789Z

[eglot] Connected! Server 'EGLOT (api-gateway/(clojure-mode clojurescript-mode clojurec-mode clojure-ts-mode))' now managing '(clojure-mode clojurescript-mode clojurec-mode clojure-ts-mode)' buffers in project 'api-gateway'.
Error muted by safe_call: (treesit--font-lock-mark-ranges-to-fontify ((1 . 7235)) #<treesit-parser for clojure>) signaled (treesit-query-error "Syntax error at" 233 "((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) . [(comment) (meta_lit) (old_meta_lit)] * . (str_lit (str_content) @capture) @_ignore . (_)) (#match \"^def$\" @_def_symbol)) ((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol . (comment) * . (meta_lit value: (map_lit (kwd_lit) @_doc-keyword . (str_lit (str_content) @capture) @_ignore))) (#match \"^\\\\(?:def\\\\(?:in\\\\(?:\\\\(?:lin\\\\|terfac\\\\)e\\\\)\\\\|m\\\\(?:acro\\\\|ulti\\\\)\\\\|n-?\\\\|once\\\\|protocol\\\\|record\\\\|struct\\\\|t\\\\(?:est-?\\\\|ype\\\\)\\\\)?\\\\|ns\\\\)$\" @_def_symbol) (#equal @_doc-keyword \":doc\")) ((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) . [(comment) (meta_lit) (old_meta_lit)] * . (str_lit (str_content) @capture) @_ignore) (#match \"^\\\\(?:def\\\\(?:inline\\\\|m\\\\(?:acro\\\\|ulti\\\\)\\\\|n-?\\\\|protocol\\\\)\\\\|ns\\\\)$\" @_def_symbol)) ((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol (list_lit . (sym_lit) (vec_lit) * (str_lit (str_content) @capture) @_ignore)) (#match \"^\\\\(?:def\\\\(?:interface\\\\|protocol\\\\)\\\\)$\" @_def_symbol))" "Debug the query with `treesit-query-validate'")
Error during redisplay: (jit-lock-function 1) signaled (treesit-query-error "Syntax error at" 233 "((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) . [(comment) (meta_lit) (old_meta_lit)] * . (str_lit (str_content) @capture) @_ignore . (_)) (#match \"^def$\" @_def_symbol)) ((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol . (comment) * . (meta_lit value: (map_lit (kwd_lit) @_doc-keyword . (str_lit (str_content) @capture) @_ignore))) (#match \"^\\\\(?:def\\\\(?:in\\\\(?:\\\\(?:lin\\\\|terfac\\\\)e\\\\)\\\\|m\\\\(?:acro\\\\|ulti\\\\)\\\\|n-?\\\\|once\\\\|protocol\\\\|record\\\\|struct\\\\|t\\\\(?:est-?\\\\|ype\\\\)\\\\)?\\\\|ns\\\\)$\" @_def_symbol) (#equal @_doc-keyword \":doc\")) ((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) . [(comment) (meta_lit) (old_meta_lit)] * . (str_lit (str_content) @capture) @_ignore) (#match \"^\\\\(?:def\\\\(?:inline\\\\|m\\\\(?:acro\\\\|ulti\\\\)\\\\|n-?\\\\|protocol\\\\)\\\\|ns\\\\)$\" @_def_symbol)) ((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol (list_lit . (sym_lit) (vec_lit) * (str_lit (str_content) @capture) @_ignore)) (#match \"^\\\\(?:def\\\\(?:interface\\\\|protocol\\\\)\\\\)$\" @_def_symbol))" "Debug the query with `treesit-query-validate'")
QuitError during redisplay: (jit-lock-function 1501) signaled (treesit-query-error "Syntax error at" 233 "((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) . [(comment) (meta_lit) (old_meta_lit)] * . (str_lit (str_content) @capture) @_ignore . (_)) (#match \"^def$\" @_def_symbol)) ((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol . (comment) * . (meta_lit value: (map_lit (kwd_lit) @_doc-keyword . (str_lit (str_content) @capture) @_ignore))) (#match \"^\\\\(?:def\\\\(?:in\\\\(?:\\\\(?:lin\\\\|terfac\\\\)e\\\\)\\\\|m\\\\(?:acro\\\\|ulti\\\\)\\\\|n-?\\\\|once\\\\|protocol\\\\|record\\\\|struct\\\\|t\\\\(?:est-?\\\\|ype\\\\)\\\\)?\\\\|ns\\\\)$\" @_def_symbol) (#equal @_doc-keyword \":doc\")) ((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) . [(comment) (meta_lit) (old_meta_lit)] * . (str_lit (str_content) @capture) @_ignore) (#match \"^\\\\(?:def\\\\(?:inline\\\\|m\\\\(?:acro\\\\|ulti\\\\)\\\\|n-?\\\\|protocol\\\\)\\\\|ns\\\\)$\" @_def_symbol)) ((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol (list_lit . (sym_lit) (vec_lit) * (str_lit (str_content) @capture) @_ignore)) (#match \"^\\\\(?:def\\\\(?:interface\\\\|protocol\\\\)\\\\)$\" @_def_symbol))" "Debug the query with `treesit-query-validate'")

pieterbreed 2026-04-21T08:13:58.481859Z

(I'm sorry, I don't have the chops to debug this myself...) claude used up all of my credits in one prompt to come up with the following tidbit: > • In tree-sitter 0.26, #match and #equal without ? suffix are invalid — only #match? and #equal? work. > • tree-sitter 0.25.x accepts #match without ?

pieterbreed 2026-04-21T08:19:53.815229Z

I've gone back to clojure-mode for now...

Roma 2026-04-21T08:41:51.036579Z

I think you are using the wrong grammar version

pieterbreed 2026-04-21T08:42:32.010419Z

How did I get to using the wrong one if it was the right one before?

Roma 2026-04-21T08:42:55.915819Z

maybe your OS provides the grammar in the repo?

Roma 2026-04-21T08:43:11.102679Z

could it be installed system-wide?

pieterbreed 2026-04-21T08:44:10.039669Z

So I'm not 100% on the how treesitter works; are you talking about libtree-sitter-clojure.so? This file is in my $/.emacs.d/tree-sitter/

Roma 2026-04-21T08:46:11.232249Z

yes. But in this directory grammars are installed by Emacs itself or manually. Did you use something to install grammars? Maybe this https://github.com/casouri/tree-sitter-module?

Roma 2026-04-21T08:46:31.237049Z

I would try M-x clojure-ts-reinstall-grammars and restart emacs

pieterbreed 2026-04-21T08:46:37.046679Z

I'm pretty sure my init.el cause those grammar files to be installed

pieterbreed 2026-04-21T08:46:48.727709Z

I'll try that

Roma 2026-04-21T08:48:42.838049Z

I think there is a chance that the required version was overwritten by "stable" version, which is incompatible with clojure-ts-mode

pieterbreed 2026-04-21T08:50:35.312359Z

re-installing the grammars did not fix the issue.

Roma 2026-04-21T08:50:54.839579Z

have you restarted emacs?

pieterbreed 2026-04-21T08:51:02.773729Z

yes

Roma 2026-04-21T08:52:32.866119Z

ok, that's interesting. Is the error reproducible in any clojure buffer? What if you open a very minimal Clojure file with just a namespace declaration for example?

Roma 2026-04-21T08:53:01.964699Z

the error says that one query is invalid, maybe there is a bug

pieterbreed 2026-04-21T08:55:37.173509Z

Same error:

Error running timer: (treesit-query-error "Syntax error at" 233 "((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) . [(comment) (meta_lit) (old_meta_lit)] * . (str_lit (str_content) @capture) @_ignore . (_)) (#match \"^def$\" @_def_symbol)) ((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol . (comment) * . (meta_lit value: (map_lit (kwd_lit) @_doc-keyword . (str_lit (str_content) @capture) @_ignore))) (#match \"^\\\\(?:def\\\\(?:in\\\\(?:\\\\(?:lin\\\\|terfac\\\\)e\\\\)\\\\|m\\\\(?:acro\\\\|ulti\\\\)\\\\|n-?\\\\|once\\\\|protocol\\\\|record\\\\|struct\\\\|t\\\\(?:est-?\\\\|ype\\\\)\\\\)?\\\\|ns\\\\)$\" @_def_symbol) (#equal @_doc-keyword \":doc\")) ((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) . [(comment) (meta_lit) (old_meta_lit)] * . (str_lit (str_content) @capture) @_ignore) (#match \"^\\\\(?:def\\\\(?:inline\\\\|m\\\\(?:acro\\\\|ulti\\\\)\\\\|n-?\\\\|protocol\\\\)\\\\|ns\\\\)$\" @_def_symbol)) ((list_lit . [(comment) (meta_lit) (old_meta_lit)] * . (sym_lit) @_def_symbol (list_lit . (sym_lit) (vec_lit) * (str_lit (str_content) @capture) @_ignore)) (#match \"^\\\\(?:def\\\\(?:interface\\\\|protocol\\\\)\\\\)$\" @_def_symbol))" "Debug the query with `treesit-query-validate'")e
with clojure file containing this:
(ns gometro.apigw.http.core2
  (:require
   [integrant.core :as ig]
   [taoensso.timbre :as log]
   [java-time.api :as t]
   [afrolabs.components :as -comp]
   [afrolabs.components.http :as -http]
   [ring.util.response :as -http-response]
   [clojure.spec.alpha :as s]
   [clojure.string :as str]))

Roma 2026-04-21T08:56:16.877529Z

what version of clojure-ts-mode are you using?

Roma 2026-04-21T08:57:25.617609Z

M-x clojure-ts-mode-display-version

👍🏽 1
pieterbreed 2026-04-21T08:57:48.216159Z

clojure-ts-mode 0.6.0 (package: <tel:202603252107|20260325.2107>)

Roma 2026-04-21T09:01:58.158409Z

Thanks, I cannot reproduce it with my current setup. I'll try to downgrade the grammar and see if the error is the same

Roma 2026-04-21T09:03:38.378629Z

no, when the grammar version is incorrect, the error is the following:

stop  Warning (treesit-font-lock-rules-mismatch): Emacs cannot compile every font-lock rules because a mismatch between the grammar and the rules.  This is most likely due to a mismatch between the font-lock rules defined by the major mode and the tree-sitter grammar.

This error can be fixed by either downgrading the grammar (tree-sitter-clojure) on your system, or upgrading the major mode package.  The following are the temporarily disabled features:

- `doc' for clojure,
- `string' for clojure.
What version of Emacs are you using?

pieterbreed 2026-04-21T09:04:23.383749Z

GNU Emacs 30.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.52, cairo version 1.18.4)

👍 1
pieterbreed 2026-04-21T09:06:16.091569Z

Thank you for checking anyway 👍🏽

Roma 2026-04-21T09:10:14.192639Z

np. If you have time, could you please try to run emacs -q, evaluate the following in the *scratch* buffer:

(package-initialize)
(require 'clojure-ts-mode)
and try to open your Clojure file? I wonder if there is some configuration issue in your init.el

pieterbreed 2026-04-21T09:13:23.537259Z

It failed in the same way

Roma 2026-04-21T09:16:04.932169Z

one more thing if you don't mind. Could you please M-x toggle-debug-on-error, then reproduce this error and post here the backtrace?

Roma 2026-04-21T09:16:41.444099Z

in any case it looks like a bug and I think we should report it, but the more details we get the better

pieterbreed 2026-04-21T09:19:22.802269Z

I'm not sure what must change when this flag is toggled? I get exactly the same behaviour (failure), but no other frames popping up with a trace or anything like that, just the same failure messages in Messages

Roma 2026-04-21T09:21:06.006779Z

ah, I guess the error is not signaled, I see in the message "Error muted by safe_call". In this case we won't get a backtrace

👍🏽 1
Roma 2026-04-21T09:27:10.698689Z

so, I have done some research, and it looks like Emacs bug: https://gitlab.archlinux.org/archlinux/packaging/packages/emacs/-/work_items/13

👀 1
Roma 2026-04-21T09:27:35.926549Z

basically emacs 30.2 is linked with tree-sitter-0.26, but there is a compatibility issue

Roma 2026-04-21T09:31:16.784319Z

if emacs-30.2 in your distro was packaged against tree-sitter-0.26.*, there is not much you can do. The best workaround would be to downgrade to emacs-30.1 or switch to master

pieterbreed 2026-04-21T09:34:40.356139Z

using clojure-mode has a less severe impact on my life 😉 Thank you so much for helping diagnose this and finding the bug report. I'll follow it and revert my setup once the updates landed.

Roma 2026-04-21T09:36:21.463799Z

understandable 🙂 Hopefully the next major release of Emacs will improve the situation with clojure-ts-mode significantly. There are many improvements and fixes, basically the reason I use master branch of Emacs 🙂

👍🏽 1
2026-04-21T10:59:28.555109Z

i think the distribution in question here (omarchy?) is based on arch linux. the link to the emacs bug presented above appears to be for arch linux -- and it looks like there was a fix made. it doesn't seem completely unlikely that omarchy will pick up the change. just my local two currency units

👍 1
👍🏽 1
Ovi Stoica 2026-04-23T08:47:08.235379Z

Usually when omarchy has os updates it will also upgrade all installed packages, and this most likely upgraded emacs, giving you this bug

👍🏽 1