pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/editors/emacs30



Module Name:    pkgsrc
Committed By:   wiz
Date:           Sun Dec 21 06:35:26 UTC 2025

Modified Files:
        pkgsrc/editors/emacs30: distinfo
Added Files:
        pkgsrc/editors/emacs30/patches: patch-src_treesit.c

Log Message:
emacs30: fix build with treesitter 0.26

Using upstream patch.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 pkgsrc/editors/emacs30/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/editors/emacs30/patches/patch-src_treesit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/editors/emacs30/distinfo
diff -u pkgsrc/editors/emacs30/distinfo:1.2 pkgsrc/editors/emacs30/distinfo:1.3
--- pkgsrc/editors/emacs30/distinfo:1.2 Thu Aug 14 21:39:28 2025
+++ pkgsrc/editors/emacs30/distinfo     Sun Dec 21 06:35:26 2025
@@ -1,5 +1,6 @@
-$NetBSD: distinfo,v 1.2 2025/08/14 21:39:28 wiz Exp $
+$NetBSD: distinfo,v 1.3 2025/12/21 06:35:26 wiz Exp $
 
 BLAKE2s (emacs-30.2.tar.xz) = f88fd83bf4d3c4ef6c2240c50e23ca570c3219da9e9a463951aaf83ef9dc931f
 SHA512 (emacs-30.2.tar.xz) = 313432d11e95c74f8cd35c5b1da442e6223f5d40f9173c55883c0339ecbfb97a0bedf79177ef8902afd3e33c078a233777bed01f5caffa1e7524f17d58bfc9a2
 Size (emacs-30.2.tar.xz) = 55320324 bytes
+SHA1 (patch-src_treesit.c) = fc3165a2febcb4dda2e87d031524fa5b90721c38

Added files:

Index: pkgsrc/editors/emacs30/patches/patch-src_treesit.c
diff -u /dev/null pkgsrc/editors/emacs30/patches/patch-src_treesit.c:1.1
--- /dev/null   Sun Dec 21 06:35:26 2025
+++ pkgsrc/editors/emacs30/patches/patch-src_treesit.c  Sun Dec 21 06:35:26 2025
@@ -0,0 +1,102 @@
+$NetBSD: patch-src_treesit.c,v 1.1 2025/12/21 06:35:26 wiz Exp $
+
+Support tree-sitter 0.26.
+
+Based on
+commit d587ce8c65a0e22ab0a63ef2873a3dfcfbeba166
+Author: Eli Zaretskii <eliz%gnu.org@localhost>
+Date:   Fri Oct 17 14:15:41 2025 +0300
+
+    Support Tree-sitter version 0.26 and later
+
+--- src/treesit.c.orig 2025-07-05 09:56:00.000000000 +0000
++++ src/treesit.c
+@@ -34,7 +34,11 @@ along with GNU Emacs.  If not, see <http
+ # include "w32common.h"
+ 
+ /* In alphabetical order.  */
++#if TREE_SITTER_LANGUAGE_VERSION >= 15
++#undef ts_language_abi_version
++#else
+ #undef ts_language_version
++#endif
+ #undef ts_node_child
+ #undef ts_node_child_by_field_name
+ #undef ts_node_child_count
+@@ -89,7 +93,11 @@ along with GNU Emacs.  If not, see <http
+ #undef ts_tree_get_changed_ranges
+ #undef ts_tree_root_node
+ 
++#if TREE_SITTER_LANGUAGE_VERSION >= 15
++DEF_DLL_FN (uint32_t, ts_language_abi_version, (const TSLanguage *));
++#else
+ DEF_DLL_FN (uint32_t, ts_language_version, (const TSLanguage *));
++#endif
+ DEF_DLL_FN (TSNode, ts_node_child, (TSNode, uint32_t));
+ DEF_DLL_FN (TSNode, ts_node_child_by_field_name,
+           (TSNode, const char *, uint32_t));
+@@ -166,7 +174,11 @@ init_treesit_functions (void)
+   if (!library)
+     return false;
+ 
++#if TREE_SITTER_LANGUAGE_VERSION >= 15
++  LOAD_DLL_FN (library, ts_language_abi_version);
++#else
+   LOAD_DLL_FN (library, ts_language_version);
++#endif
+   LOAD_DLL_FN (library, ts_node_child);
+   LOAD_DLL_FN (library, ts_node_child_by_field_name);
+   LOAD_DLL_FN (library, ts_node_child_count);
+@@ -224,7 +236,11 @@ init_treesit_functions (void)
+   return true;
+ }
+ 
++#if TREE_SITTER_LANGUAGE_VERSION >= 15
++#define ts_language_abi_version fn_ts_language_abi_version
++#else
+ #define ts_language_version fn_ts_language_version
++#endif
+ #define ts_node_child fn_ts_node_child
+ #define ts_node_child_by_field_name fn_ts_node_child_by_field_name
+ #define ts_node_child_count fn_ts_node_child_count
+@@ -632,6 +648,22 @@ treesit_load_language_push_for_each_suff
+     }
+ }
+ 
++/* This function is a compatibility shim.  Tree-sitter 0.25 introduced
++   ts_language_abi_version as a replacement for ts_language_version, and
++   tree-sitter 0.26 removed ts_language_version.  Here we use the fact
++   that 0.25 bumped TREE_SITTER_LANGUAGE_VERSION to 15, to use the new
++   function instead of the old one, when Emacs is compiled against
++   tree-sitter version 0.25 or newer.  */
++static uint32_t
++treesit_language_abi_version (const TSLanguage *ts_lang)
++{
++#if TREE_SITTER_LANGUAGE_VERSION >= 15
++  return ts_language_abi_version (ts_lang);
++#else
++  return ts_language_version (ts_lang);
++#endif
++}
++
+ /* Load the dynamic library of LANGUAGE_SYMBOL and return the pointer
+    to the language definition.
+ 
+@@ -746,7 +778,7 @@ treesit_load_language (Lisp_Object langu
+     {
+       *signal_symbol = Qtreesit_load_language_error;
+       *signal_data = list2 (Qversion_mismatch,
+-                          make_fixnum (ts_language_version (lang)));
++                          make_fixnum (treesit_language_abi_version (lang)));
+       return NULL;
+     }
+   return lang;
+@@ -817,7 +849,7 @@ Return nil if a grammar library for LANG
+                                                      &signal_data);
+       if (ts_language == NULL)
+       return Qnil;
+-      uint32_t version =  ts_language_version (ts_language);
++      uint32_t version =  treesit_language_abi_version (ts_language);
+       return make_fixnum((ptrdiff_t) version);
+     }
+ }



Home | Main Index | Thread Index | Old Index