Commit b2d91e20 authored by Lin Jian's avatar Lin Jian
Browse files

emacs: update patches for tree-sitter 0.26 compatibility

The vendored patch fixing build issue is replaced by fetching from
Gentoo.  In addition, another patch from Gentoo is added to fix the
runtime issue.
parent 76f759a9
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -252,13 +252,10 @@ stdenv.mkDerivation (finalAttrs: {
  nativeBuildInputs = [
    makeWrapper
    pkg-config
  ]
  ++ lib.optionals (variant == "macport") [
    texinfo
  ]
  ++ lib.optionals srcRepo [
    autoreconfHook
    texinfo
  ]
  ++ lib.optionals (withPgtk || withX && (withGTK3 || withXwidgets)) [ wrapGAppsHook3 ];

+10 −3
Original line number Diff line number Diff line
@@ -121,9 +121,16 @@ in
        name = "inhibit-lexical-cookie-warning-67916.patch";
        path = ./inhibit-lexical-cookie-warning-67916-30.patch;
      })
      # tree-sitter 0.26 compatibility fix, from FreeBSD
      # https://cgit.freebsd.org/ports/plain/editors/emacs/files/patch-src_treesit.c
      ./tree-sitter-0.26.patch
      (fetchpatch {
        # tree-sitter 0.26 compatibility fix, see https://bugs.gentoo.org/970856
        url = "https://gitweb.gentoo.org/proj/emacs-patches.git/plain/emacs/30.2/01_all_treesit-0.26.patch?id=d0f47979806d9be5a190fdb4ffa1bde439b2d616";
        hash = "sha256-3pWeRxjAhr3ntBR3xDhoDUZDjU6xICU23NUpb/Vl6R4=";
      })
      (fetchpatch {
        # tree-sitter 0.26 compatibility fix, see https://bugs.gentoo.org/971731
        url = "https://gitweb.gentoo.org/proj/emacs-patches.git/plain/emacs/30.2/02_all_ts-query-pred.patch?id=86190bf195b3e17108372d8ad89eb57037180dd2";
        hash = "sha256-0GPyfKLSaB09a8hamrSf6lx4Qk8Big4AKMOivkN1wEM=";
      })
    ];
  });

+0 −56
Original line number Diff line number Diff line
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -34,7 +34,7 @@ along with GNU Emacs.  If not, see <https://www.gnu.or
 # include "w32common.h"
 
 /* In alphabetical order.  */
-#undef ts_language_version
+#undef ts_language_abi_version
 #undef ts_node_child
 #undef ts_node_child_by_field_name
 #undef ts_node_child_count
@@ -89,7 +89,7 @@ along with GNU Emacs.  If not, see <https://www.gnu.or
 #undef ts_tree_get_changed_ranges
 #undef ts_tree_root_node
 
-DEF_DLL_FN (uint32_t, ts_language_version, (const TSLanguage *));
+DEF_DLL_FN (uint32_t, ts_language_abi_version, (const TSLanguage *));
 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 +166,7 @@ init_treesit_functions (void)
   if (!library)
     return false;
 
-  LOAD_DLL_FN (library, ts_language_version);
+  LOAD_DLL_FN (library, ts_language_abi_version);
   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 +224,7 @@ init_treesit_functions (void)
   return true;
 }
 
-#define ts_language_version fn_ts_language_version
+#define ts_language_abi_version fn_ts_language_abi_version
 #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
@@ -746,7 +746,7 @@ treesit_load_language (Lisp_Object language_symbol,
     {
       *signal_symbol = Qtreesit_load_language_error;
       *signal_data = list2 (Qversion_mismatch,
-			    make_fixnum (ts_language_version (lang)));
+			    make_fixnum (ts_language_abi_version (lang)));
       return NULL;
     }
   return lang;
@@ -817,7 +817,7 @@ Return nil if a grammar library for LANGUAGE is not av
 						       &signal_data);
       if (ts_language == NULL)
 	return Qnil;
-      uint32_t version =  ts_language_version (ts_language);
+      uint32_t version =  ts_language_abi_version (ts_language);
       return make_fixnum((ptrdiff_t) version);
     }
 }
 No newline at end of file