Your message dated Thu, 25 Jun 2026 22:49:46 +0000
with message-id <[email protected]>
and subject line Bug#1140604: fixed in emacs 1:30.2+1-7
has caused the Debian Bug report #1140604,
regarding emacs: tree-sitter query incompatible with tree-siter 0.26.x
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1140604: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1140604
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: emacs
Version: 1:30.2+1-6
Severity: important

The tree-sitter patch included in 1:30.2+1-4 fixed building, but the
tree-sitter query supported in Emacs 30.2 is incompatible with
tree-sitter 0.26+. More details in [1].

I have backported the suggested patch from upstream[2], and adapted to
the Debian version. Tested in a docker image that the syntax
high-lighting is working now (tried source code in C, C++, Python, and
Java). Please find in the attachment.

(Note: I'm using important severity to avoid blocking Emacs migration,
which may further delay the tree-sitter transition. Please feel free to
adjust.)

[1] https://github.com/doomemacs/core/issues/8746#issuecomment-4233133006
[2] 
https://gitlab.archlinux.org/archlinux/packaging/packages/emacs/-/blob/30.2-3/02_all_ts-query-pred.patch?ref_type=tags

-- System Information:
Debian Release: forky/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (200, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 7.0.13+deb14-amd64 (SMP w/2 CPU threads; PREEMPT)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages emacs depends on:
ii  emacs-gtk  1:30.2+1-6

emacs recommends no packages.

emacs suggests no packages.

-- no debconf information

-- 
Regards,
Xiyue Deng
From 7c7e3af01d57bdb869d469dc102cb957eaf7b322 Mon Sep 17 00:00:00 2001
From: Yuan Fu <[email protected]>
Date: Sun, 2 Nov 2025 16:16:50 -0800
Subject: [PATCH] Change tree-sitter query predicate names (bug#79687)

Latest tree-sitter library throws a syntax error if the
predicate names in a query don't end with question mark.  So we
made the following change:

:equal changed to :eq?
:match changed to :match?
:pred changed to :pred?

Old names are transparently converted to new names when
expanding patterns.

:match predicate can now take the regexp and the node in any
order: it'll figure out which is which automatically. This way
it works with current Emacs convention (regexp first), as well
as tree-sitter's match convention (regexp second).

* doc/lispref/parsing.texi (Pattern Matching): Update manuel to
use new predicate names.
* src/treesit.c:
(Ftreesit_pattern_expand):
(Ftreesit_query_expand):
(treesit_predicate_match):
(treesit_eval_predicates):
(syms_of_treesit): Use new predicate names.
* test/src/treesit-tests.el (treesit-query-api): Update test.
---
 src/treesit.c             | 101 +++++++++++++++++++++-----------------
 test/src/treesit-tests.el |   6 +--
 2 files changed, 58 insertions(+), 49 deletions(-)

diff --git a/src/treesit.c b/src/treesit.c
index f87f4654209..bf212639078 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -431,17 +431,17 @@ #define ts_tree_root_node fn_ts_tree_root_node
 static Lisp_Object Vtreesit_str_question_mark;
 static Lisp_Object Vtreesit_str_star;
 static Lisp_Object Vtreesit_str_plus;
-static Lisp_Object Vtreesit_str_pound_equal;
-static Lisp_Object Vtreesit_str_pound_match;
-static Lisp_Object Vtreesit_str_pound_pred;
+static Lisp_Object Vtreesit_str_pound_eq_question_mark;
+static Lisp_Object Vtreesit_str_pound_match_question_mark;
+static Lisp_Object Vtreesit_str_pound_pred_question_mark;
 static Lisp_Object Vtreesit_str_open_bracket;
 static Lisp_Object Vtreesit_str_close_bracket;
 static Lisp_Object Vtreesit_str_open_paren;
 static Lisp_Object Vtreesit_str_close_paren;
 static Lisp_Object Vtreesit_str_space;
-static Lisp_Object Vtreesit_str_equal;
-static Lisp_Object Vtreesit_str_match;
-static Lisp_Object Vtreesit_str_pred;
+static Lisp_Object Vtreesit_str_eq_question_mark;
+static Lisp_Object Vtreesit_str_match_question_mark;
+static Lisp_Object Vtreesit_str_pred_question_mark;
 static Lisp_Object Vtreesit_str_empty;
 
 /* This is the limit on recursion levels for some tree-sitter
@@ -2636,12 +2636,12 @@ DEFUN ("treesit-pattern-expand",
     return Vtreesit_str_star;
   if (BASE_EQ (pattern, QCplus))
     return Vtreesit_str_plus;
-  if (BASE_EQ (pattern, QCequal))
-    return Vtreesit_str_pound_equal;
-  if (BASE_EQ (pattern, QCmatch))
-    return Vtreesit_str_pound_match;
-  if (BASE_EQ (pattern, QCpred))
-    return Vtreesit_str_pound_pred;
+  if (BASE_EQ (pattern, QCequal) || BASE_EQ (pattern, QCeq_q))
+    return Vtreesit_str_pound_eq_question_mark;
+  if (BASE_EQ (pattern, QCmatch) || BASE_EQ (pattern, QCmatch_q))
+    return Vtreesit_str_pound_match_question_mark;
+  if (BASE_EQ (pattern, QCpred) || BASE_EQ (pattern, QCpred_q))
+    return Vtreesit_str_pound_pred_question_mark;
   Lisp_Object opening_delimeter
     = VECTORP (pattern)
       ? Vtreesit_str_open_bracket : Vtreesit_str_open_paren;
@@ -2672,7 +2672,9 @@ DEFUN ("treesit-query-expand",
     :*
     :+
     :equal
+    :eq?
     :match
+    :match?
     (TYPE PATTERN...)
     [PATTERN...]
     FIELD-NAME:
@@ -2835,7 +2837,7 @@ treesit_predicate_equal (Lisp_Object args, struct capture_range captures,
   return !NILP (Fstring_equal (text1, text2));
 }
 
-/* Handles predicate (#match "regexp" @node).  Return true if "regexp"
+/* Handles predicate (#match? "regexp" @node).  Return true if "regexp"
    matches the text spanned by @node; return false otherwise.
    Matching is case-sensitive.  If everything goes fine, don't touch
    SIGNAL_DATA; if error occurs, set it to a suitable signal data.  */
@@ -2845,26 +2847,25 @@ treesit_predicate_match (Lisp_Object args, struct capture_range captures,
 {
   if (list_length (args) != 2)
     {
-      *signal_data = list2 (build_string ("Predicate `match' requires two "
+      *signal_data = list2 (build_string ("Predicate `match?' requires two "
 					  "arguments but got"),
 			    Flength (args));
       return false;
     }
-  Lisp_Object regexp = XCAR (args);
-  Lisp_Object capture_name = XCAR (XCDR (args));
-
-  /* It's probably common to get the argument order backwards.  Catch
-     this mistake early and show helpful explanation, because Emacs
-     loves you.  (We put the regexp first because that's what
-     string-match does.)  */
-  if (!STRINGP (regexp))
-    xsignal1 (Qtreesit_query_error,
-	      build_string ("The first argument to `match' should "
-		            "be a regexp string, not a capture name"));
-  if (!SYMBOLP (capture_name))
-    xsignal1 (Qtreesit_query_error,
-	      build_string ("The second argument to `match' should "
-		            "be a capture name, not a string"));
+  Lisp_Object arg1 = XCAR (args);
+  Lisp_Object arg2 = XCAR (XCDR (args));
+  Lisp_Object regexp = SYMBOLP (arg2) ? arg1 : arg2;
+  Lisp_Object capture_name = SYMBOLP (arg2) ? arg2 : arg1;
+
+  if (!STRINGP (regexp) || !SYMBOLP (capture_name))
+    {
+      *signal_data = list2 (build_string ("Predicate `match?' takes a regexp "
+	                                  "and a node capture (order doesn't "
+					  "matter), but got"),
+			    Flength (args));
+      return false;
+    }
+
 
   Lisp_Object node = Qnil;
   if (!treesit_predicate_capture_name_to_node (capture_name, captures, &node,
@@ -2948,11 +2949,11 @@ treesit_eval_predicates (struct capture_range captures, Lisp_Object predicates,
       Lisp_Object predicate = XCAR (tail);
       Lisp_Object fn = XCAR (predicate);
       Lisp_Object args = XCDR (predicate);
-      if (!NILP (Fstring_equal (fn, Vtreesit_str_equal)))
+      if (!NILP (Fstring_equal (fn, Vtreesit_str_eq_question_mark)))
 	pass &= treesit_predicate_equal (args, captures, signal_data);
-      else if (!NILP (Fstring_equal (fn, Vtreesit_str_match)))
+      else if (!NILP (Fstring_equal (fn, Vtreesit_str_match_question_mark)))
 	pass &= treesit_predicate_match (args, captures, signal_data);
-      else if (!NILP (Fstring_equal (fn, Vtreesit_str_pred)))
+      else if (!NILP (Fstring_equal (fn, Vtreesit_str_pred_question_mark)))
 	pass &= treesit_predicate_pred (args, captures, signal_data);
       else
 	{
@@ -4224,8 +4225,16 @@ syms_of_treesit (void)
   DEFSYM (QCstar, ":*");
   DEFSYM (QCplus, ":+");
   DEFSYM (QCequal, ":equal");
+  DEFSYM (QCeq_q, ":eq?");
   DEFSYM (QCmatch, ":match");
+  DEFSYM (QCmatch_q, ":match?");
   DEFSYM (QCpred, ":pred");
+  DEFSYM (QCpred_q, ":pred?");
+  DEFSYM (QCline, ":line");
+  DEFSYM (QCcol, ":col");
+  DEFSYM (QCpos, ":pos");
+  DEFSYM (QCbytepos, ":bytepos");
+
 
   DEFSYM (Qnot_found, "not-found");
   DEFSYM (Qsymbol_error, "symbol-error");
@@ -4355,13 +4364,13 @@ cons (REGEXP . FN), which is a combination of a regexp and a predicate
   staticpro (&Vtreesit_str_star);
   Vtreesit_str_star = build_pure_c_string ("*");
   staticpro (&Vtreesit_str_plus);
-  Vtreesit_str_plus = build_pure_c_string ("+");
-  staticpro (&Vtreesit_str_pound_equal);
-  Vtreesit_str_pound_equal = build_pure_c_string ("#equal");
-  staticpro (&Vtreesit_str_pound_match);
-  Vtreesit_str_pound_match = build_pure_c_string ("#match");
-  staticpro (&Vtreesit_str_pound_pred);
-  Vtreesit_str_pound_pred = build_pure_c_string ("#pred");
+  Vtreesit_str_plus = build_string ("+");
+  staticpro (&Vtreesit_str_pound_eq_question_mark);
+  Vtreesit_str_pound_eq_question_mark = build_string ("#eq?");
+  staticpro (&Vtreesit_str_pound_match_question_mark);
+  Vtreesit_str_pound_match_question_mark = build_string ("#match?");
+  staticpro (&Vtreesit_str_pound_pred_question_mark);
+  Vtreesit_str_pound_pred_question_mark = build_string ("#pred?");
   staticpro (&Vtreesit_str_open_bracket);
   Vtreesit_str_open_bracket = build_pure_c_string ("[");
   staticpro (&Vtreesit_str_close_bracket);
@@ -4371,13 +4380,13 @@ cons (REGEXP . FN), which is a combination of a regexp and a predicate
   staticpro (&Vtreesit_str_close_paren);
   Vtreesit_str_close_paren = build_pure_c_string (")");
   staticpro (&Vtreesit_str_space);
-  Vtreesit_str_space = build_pure_c_string (" ");
-  staticpro (&Vtreesit_str_equal);
-  Vtreesit_str_equal = build_pure_c_string ("equal");
-  staticpro (&Vtreesit_str_match);
-  Vtreesit_str_match = build_pure_c_string ("match");
-  staticpro (&Vtreesit_str_pred);
-  Vtreesit_str_pred = build_pure_c_string ("pred");
+  Vtreesit_str_space = build_string (" ");
+  staticpro (&Vtreesit_str_eq_question_mark);
+  Vtreesit_str_eq_question_mark = build_string ("eq?");
+  staticpro (&Vtreesit_str_match_question_mark);
+  Vtreesit_str_match_question_mark = build_string ("match?");
+  staticpro (&Vtreesit_str_pred_question_mark);
+  Vtreesit_str_pred_question_mark = build_string ("pred?");
   staticpro (&Vtreesit_str_empty);
   Vtreesit_str_empty = build_pure_c_string ("");
 
diff --git a/test/src/treesit-tests.el b/test/src/treesit-tests.el
index 7cbe516fc42..8fa8f098113 100644
--- a/test/src/treesit-tests.el
+++ b/test/src/treesit-tests.el
@@ -434,10 +434,10 @@ treesit-query-api
                ;; String query.
                '("(string) @string
 (pair key: (_) @keyword)
-((_) @bob (#match \"\\\\`B.b\\\\'\" @bob))
+((_) @bob (#match? \"\\\\`B.b\\\\'\" @bob))
 (number) @number
-((number) @n3 (#equal \"3\" @n3))
-((number) @n3p (#pred treesit--ert-pred-last-sibling @n3p))"
+((number) @n3 (#eq? \"3\" @n3))
+((number) @n3p (#pred? treesit--ert-pred-last-sibling @n3p))"
                  ;; Sexp query.
                  ((string) @string
                   (pair key: (_) @keyword)
-- 
2.53.0

Attachment: signature.asc
Description: PGP signature


--- End Message ---
--- Begin Message ---
Source: emacs
Source-Version: 1:30.2+1-7
Done: Rob Browning <[email protected]>

We believe that the bug you reported is fixed in the latest version of
emacs, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Rob Browning <[email protected]> (supplier of updated emacs package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Thu, 25 Jun 2026 12:37:45 -0500
Source: emacs
Architecture: source
Version: 1:30.2+1-7
Distribution: unstable
Urgency: medium
Maintainer: Rob Browning <[email protected]>
Changed-By: Rob Browning <[email protected]>
Closes: 1140604
Changes:
 emacs (1:30.2+1-7) unstable; urgency=medium
 .
   * debian/rules: fix the periodic pstree that detects hung tests.  Make
     sure the periodic reporting is killed after an hour so that we don't
     hold up the buildds (which let a build continue if it's still
     generating output), and generate the pstree of the testing command,
     not the pstree loop.
 .
   * Support Tree-sitter 0.26 queries.  The newer version changed the query
     syntax, so add
     0028-Change-tree-sitter-query-predicate-names-bug-79687.patch to
     include the upstream accommodation.  Thanks to Xiyue Deng for
     reporting the problem and finding the upstream fix. (Closes: 1140604)
Checksums-Sha1:
 0fe1495f420f13e4e116ca3044ecc673c95a8975 3764 emacs_30.2+1-7.dsc
 1ff51c16f6521194349ddd6d08560d9ce651278a 77628 emacs_30.2+1-7.debian.tar.xz
Checksums-Sha256:
 9682b90370dea3365897a2fccf4d24b5c11010b9ddb66f0fd753832a534dcba1 3764 
emacs_30.2+1-7.dsc
 785ca226a7e8fad47cea923254215606a279f5d3bab2b6c2096824e326b9a2a0 77628 
emacs_30.2+1-7.debian.tar.xz
Files:
 0217a49d0317117c884bbb3dd6abcc46 3764 editors optional emacs_30.2+1-7.dsc
 fefc7892cf96b4ad6c9dd85149f4debf 77628 editors optional 
emacs_30.2+1-7.debian.tar.xz

-----BEGIN PGP SIGNATURE-----

iQJJBAEBCgAzFiEEPTFSABe5ruOuhW+97vEWxVpaQvEFAmo9q5cVHHJsYkBkZWZh
dWx0dmFsdWUub3JnAAoJEO7xFsVaWkLxrzsP/1prMONEYR1DNhUdSFNZ+XCZxwJD
AFA/tC55PzX44EV0jUHapUWY+QbVwlg0u/WYGauW3xE7Fv3Y70oweewbEawXDNsb
ZJBXqZGsjd+ASApWQNzR16L+JQmiGRdwTqW5gl4UTTSiAvcRPiVrZ4njp+lq+XIz
S1r+nJ1UUVEaaWHomXVpC3aGnp/80DBw89oKMp301iXBHAvaoaIQ15nTcoRX7+fz
L7nWx1R4cCHCb0sht0kL5lEerU/k/PYeoogQWM6OJi9cD9210HgGNofFNwxqLFIC
IsFHTyersnezRDq1mU1YrmFivMje93dDLj2YEBA3plX0vpkJFnZqpMbiOuDpIqg5
GrU1ldGgfd0pE6SBIAkKPp9UtwPMSleJXPxNr/PaDM5P3+7ZETAfn5ZLvBEW9Sop
X0QMpvxL8XpeZK4Fst7Cn2lMdKNndnkcRxg9vXkicz930FepjfR3nxbdSQStZj+6
9CzB00GJg5o/7u/6V2wgXbH3gHD+RLXt7uifzK5Cue1p2FBijCUKwZe4l9buRuwx
ZoBNt25wO7haG0iTle2fAqb0Of0MzsxP93XQMy12t6tapuWlIUj0O7nkZi8taJVT
cbwOnIZy5bNMIUE9h/mWFgQffG1X8yTOyUEdLOeZh3Pmg6V6bXGWIKsHiesqgT8H
ffUIM1eTU5mtnnV1
=7Z/0
-----END PGP SIGNATURE-----

Attachment: pgp5aaw4V75DB.pgp
Description: PGP signature


--- End Message ---

Reply via email to