(require 'treesit)
(eval-when-compile (require 'rx))
-
-(declare-function treesit-node-start "treesit.c")
-(declare-function treesit-node-end "treesit.c")
-(declare-function treesit-node-type "treesit.c")
-(declare-function treesit-node-parent "treesit.c")
-(declare-function treesit-node-prev-sibling "treesit.c")
-(declare-function treesit-parser-language "treesit.c")
-(declare-function treesit-node-match-p "treesit.c")
-(declare-function treesit-node-child "treesit.c")
-(declare-function treesit-node-eq "treesit.c")
-(declare-function treesit-parser-root-node "treesit.c")
-(declare-function treesit-node-parser "treesit.c")
+(treesit-declare-unavailable-functions)
;;; Comment indentation and filling
(require 'treesit)
(require 'c-ts-common)
(eval-when-compile (require 'rx))
-
-(declare-function treesit-parser-create "treesit.c")
-(declare-function treesit-parser-root-node "treesit.c")
-(declare-function treesit-parser-set-included-ranges "treesit.c")
-(declare-function treesit-node-parent "treesit.c")
-(declare-function treesit-node-start "treesit.c")
-(declare-function treesit-node-end "treesit.c")
-(declare-function treesit-node-child "treesit.c")
-(declare-function treesit-node-child-by-field-name "treesit.c")
-(declare-function treesit-node-type "treesit.c")
-(declare-function treesit-node-prev-sibling "treesit.c")
-(declare-function treesit-node-first-child-for-pos "treesit.c")
-(declare-function treesit-node-next-sibling "treesit.c")
-(declare-function treesit-node-eq "treesit.c")
-(declare-function treesit-node-match-p "treesit.c")
-(declare-function treesit-query-compile "treesit.c")
-(declare-function treesit-node-check "treesit.c")
+(treesit-declare-unavailable-functions)
;;; Custom variables
(require 'treesit)
(eval-when-compile (require 'rx))
-
-(declare-function treesit-parser-create "treesit.c")
-(declare-function treesit-query-capture "treesit.c")
-(declare-function treesit-node-type "treesit.c")
-(declare-function treesit-search-subtree "treesit.c")
+(treesit-declare-unavailable-functions)
(defcustom cmake-ts-mode-indent-offset 2
"Number of spaces for each indentation step in `cmake-ts-mode'."
(require 'cc-langs)
(require 'treesit)
(require 'c-ts-common) ; For comment indenting and filling.
+(treesit-declare-unavailable-functions)
(eval-when-compile
(require 'cc-fonts)
(require 'rx))
-(declare-function treesit-parser-create "treesit.c")
-(declare-function treesit-induce-sparse-tree "treesit.c")
-(declare-function treesit-node-start "treesit.c")
-(declare-function treesit-node-type "treesit.c")
-(declare-function treesit-node-child-by-field-name "treesit.c")
-(declare-function treesit-query-capture "treesit.c")
-(declare-function treesit-query-compile "treesit.c")
-
(defgroup csharp nil
"Major mode for editing C# code."
:group 'prog-mode)
(require 'treesit)
(eval-when-compile (require 'rx))
-
-(declare-function treesit-parser-create "treesit.c")
-(declare-function treesit-node-child "treesit.c")
-(declare-function treesit-node-child-by-field-name "treesit.c")
-(declare-function treesit-node-type "treesit.c")
+(treesit-declare-unavailable-functions)
(defvar dockerfile-ts-mode--syntax-table
(let ((table (make-syntax-table)))
(require 'treesit)
(eval-when-compile (require 'rx))
-
-(declare-function treesit-parser-create "treesit.c")
-(declare-function treesit-node-child "treesit.c")
-(declare-function treesit-node-type "treesit.c")
-(declare-function treesit-node-child-by-field-name "treesit.c")
-(declare-function treesit-parser-language "treesit.c")
-(declare-function treesit-parser-included-ranges "treesit.c")
-(declare-function treesit-parser-list "treesit.c")
-(declare-function treesit-node-p "treesit.c")
-(declare-function treesit-node-parent "treesit.c")
-(declare-function treesit-node-start "treesit.c")
-(declare-function treesit-node-end "treesit.c")
-(declare-function treesit-query-compile "treesit.c")
-(declare-function treesit-query-capture "treesit.c")
-(declare-function treesit-node-eq "treesit.c")
-(declare-function treesit-node-prev-sibling "treesit.c")
+(treesit-declare-unavailable-functions)
(defgroup elixir-ts nil
"Major mode for editing Elixir code."
(require 'treesit)
(eval-when-compile (require 'rx))
-
-(declare-function treesit-parser-create "treesit.c")
-(declare-function treesit-induce-sparse-tree "treesit.c")
-(declare-function treesit-node-child "treesit.c")
-(declare-function treesit-node-child-by-field-name "treesit.c")
-(declare-function treesit-node-start "treesit.c")
-(declare-function treesit-node-end "treesit.c")
-(declare-function treesit-node-type "treesit.c")
-(declare-function treesit-search-subtree "treesit.c")
+(treesit-declare-unavailable-functions)
(defcustom go-ts-mode-indent-offset 8
"Number of spaces for each indentation step in `go-ts-mode'."
(require 'treesit)
(eval-when-compile (require 'rx))
-
-(declare-function treesit-parser-create "treesit.c")
-(declare-function treesit-node-child "treesit.c")
-(declare-function treesit-node-type "treesit.c")
-(declare-function treesit-node-start "treesit.c")
+(treesit-declare-unavailable-functions)
(defgroup heex-ts nil
"Major mode for editing HEEx code."
(require 'treesit)
(eval-when-compile (require 'rx))
(require 'c-ts-common) ; For comment indent and filling.
-
-(declare-function treesit-parser-create "treesit.c")
-(declare-function treesit-induce-sparse-tree "treesit.c")
-(declare-function treesit-node-start "treesit.c")
-(declare-function treesit-node-type "treesit.c")
-(declare-function treesit-node-child-by-field-name "treesit.c")
-(declare-function treesit-node-child-by-field-name "treesit.c")
-(declare-function treesit-query-capture "treesit.c")
+(treesit-declare-unavailable-functions)
(defcustom java-ts-mode-indent-offset 4
"Number of spaces for each indentation step in `java-ts-mode'."
(require 'prog-mode)
(require 'treesit)
(require 'c-ts-common) ; For comment indent and filling.
+(treesit-declare-unavailable-functions)
(eval-when-compile
(require 'cl-lib)
(require 'rx))
-(declare-function treesit-parser-create "treesit.c")
-(declare-function treesit-induce-sparse-tree "treesit.c")
-(declare-function treesit-search-subtree "treesit.c")
-(declare-function treesit-node-parent "treesit.c")
-(declare-function treesit-node-child "treesit.c")
-(declare-function treesit-node-child-by-field-name "treesit.c")
-(declare-function treesit-node-next-sibling "treesit.c")
-(declare-function treesit-node-start "treesit.c")
-(declare-function treesit-node-end "treesit.c")
-(declare-function treesit-node-type "treesit.c")
-(declare-function treesit-query-compile "treesit.c")
-(declare-function treesit-query-capture "treesit.c")
-
;;; Constants
(defconst js--name-start-re "[[:alpha:]_$]"
(require 'treesit)
(require 'rx)
-
-(declare-function treesit-parser-create "treesit.c")
-(declare-function treesit-induce-sparse-tree "treesit.c")
-(declare-function treesit-node-start "treesit.c")
-(declare-function treesit-node-type "treesit.c")
-(declare-function treesit-node-child-by-field-name "treesit.c")
-
+(treesit-declare-unavailable-functions)
(defcustom json-ts-mode-indent-offset 2
"Number of spaces for each indentation step in `json-ts-mode'."
(require 'comint)
(require 'treesit)
+(treesit-declare-unavailable-functions)
(eval-when-compile
(require 'rx))
-(declare-function treesit-induce-sparse-tree "treesit.c")
-(declare-function treesit-node-child-by-field-name "treesit.c")
-(declare-function treesit-node-child-count "treesit.c")
-(declare-function treesit-node-eq "treesit.c")
-(declare-function treesit-node-first-child-for-pos "treesit.c")
-(declare-function treesit-node-parent "treesit.c")
-(declare-function treesit-node-prev-sibling "treesit.c")
-(declare-function treesit-node-start "treesit.c")
-(declare-function treesit-node-end "treesit.c")
-(declare-function treesit-node-type "treesit.c")
-(declare-function treesit-parser-create "treesit.c")
-(declare-function treesit-search-subtree "treesit.c")
-
(defgroup lua-ts nil
"Major mode for editing Lua files."
:prefix "lua-ts-"
(require 'css-mode) ;; for embed css into html
(require 'js) ;; for embed javascript into html
(require 'comint)
+(treesit-declare-unavailable-functions)
(eval-when-compile
(require 'cl-lib)
(require 'rx)
(require 'subr-x))
-(declare-function treesit-node-child "treesit.c")
-(declare-function treesit-node-child-by-field-name "treesit.c")
-(declare-function treesit-node-end "treesit.c")
-(declare-function treesit-node-parent "treesit.c")
-(declare-function treesit-node-start "treesit.c")
-(declare-function treesit-node-string "treesit.c")
-(declare-function treesit-node-type "treesit.c")
-(declare-function treesit-parser-add-notifier "treesit.c")
-(declare-function treesit-parser-buffer "treesit.c")
-(declare-function treesit-parser-create "treesit.c")
-(declare-function treesit-parser-included-ranges "treesit.c")
-(declare-function treesit-parser-list "treesit.c")
-(declare-function treesit-parser-language "treesit.c")
-(declare-function treesit-query-compile "treesit.c")
-(declare-function treesit-search-forward "treesit.c")
-(declare-function treesit-node-prev-sibling "treesit.c")
-(declare-function treesit-node-first-child-for-pos "treesit.c")
-
;;; Install treesitter language parsers
(defvar php-ts-mode--language-source-alist
'((php . ("https://github.com/tree-sitter/tree-sitter-php" "v0.23.11" "php/src"))
(require 'subr-x)
(require 'treesit))
-(declare-function treesit-available-p "treesit.c")
-(declare-function treesit-parser-list "treesit.c")
-(declare-function treesit-node-type "treesit.c")
-(declare-function treesit-node-at "treesit.c")
-(declare-function treesit-node-match-p "treesit.c")
+(treesit-declare-unavailable-functions)
(defgroup prog-mode nil
"Generic programming mode, from which others derive."
(require 'compat)
(require 'project nil 'noerror)
(require 'seq)
+(treesit-declare-unavailable-functions)
;; Avoid compiler warnings
(defvar compilation-error-regexp-alist)
(defvar outline-heading-end-regexp)
-(declare-function treesit-parser-create "treesit.c")
-(declare-function treesit-induce-sparse-tree "treesit.c")
-(declare-function treesit-node-child-by-field-name "treesit.c")
-(declare-function treesit-node-type "treesit.c")
-(declare-function treesit-node-start "treesit.c")
-(declare-function treesit-node-end "treesit.c")
-(declare-function treesit-node-parent "treesit.c")
-(declare-function treesit-node-prev-sibling "treesit.c")
-
(autoload 'comint-mode "comint")
(autoload 'help-function-arglist "help-fns")
(require 'treesit)
(require 'ruby-mode)
-
-(declare-function treesit-parser-create "treesit.c")
-(declare-function treesit-induce-sparse-tree "treesit.c")
-(declare-function treesit-node-child-by-field-name "treesit.c")
-(declare-function treesit-search-subtree "treesit.c")
-(declare-function treesit-node-parent "treesit.c")
-(declare-function treesit-node-next-sibling "treesit.c")
-(declare-function treesit-node-type "treesit.c")
-(declare-function treesit-node-child "treesit.c")
-(declare-function treesit-node-end "treesit.c")
-(declare-function treesit-node-start "treesit.c")
-(declare-function treesit-node-string "treesit.c")
-(declare-function treesit-query-compile "treesit.c")
-(declare-function treesit-query-capture "treesit.c")
-(declare-function treesit-parser-add-notifier "treesit.c")
-(declare-function treesit-parser-buffer "treesit.c")
-(declare-function treesit-parser-list "treesit.c")
+(treesit-declare-unavailable-functions)
(defgroup ruby-ts nil
"Major mode for editing Ruby code."
(require 'treesit)
(eval-when-compile (require 'rx))
(require 'c-ts-common) ; For comment indent and filling.
-
-(declare-function treesit-parser-create "treesit.c")
-(declare-function treesit-induce-sparse-tree "treesit.c")
-(declare-function treesit-node-child "treesit.c")
-(declare-function treesit-node-child-by-field-name "treesit.c")
-(declare-function treesit-node-start "treesit.c")
-(declare-function treesit-node-end "treesit.c")
-(declare-function treesit-node-type "treesit.c")
-(declare-function treesit-node-parent "treesit.c")
-(declare-function treesit-query-compile "treesit.c")
+(treesit-declare-unavailable-functions)
(defcustom rust-ts-mode-indent-offset 4
"Number of spaces for each indentation step in `rust-ts-mode'."
(require 'subr-x))
(require 'executable)
(require 'treesit)
-
-(declare-function treesit-parser-create "treesit.c")
+(treesit-declare-unavailable-functions)
(autoload 'comint-completion-at-point "comint")
(autoload 'comint-filename-completion "comint")
(require 'js)
(eval-when-compile (require 'rx))
(require 'c-ts-common) ; For comment indent and filling.
-
-(declare-function treesit-node-child "treesit.c")
-(declare-function treesit-node-start "treesit.c")
-(declare-function treesit-node-end "treesit.c")
-(declare-function treesit-parser-create "treesit.c")
-(declare-function treesit-query-capture "treesit.c")
-(declare-function treesit-query-compile "treesit.c")
+(treesit-declare-unavailable-functions)
(defcustom typescript-ts-mode-indent-offset 2
"Number of spaces for each indentation step in `typescript-ts-mode'."
;;; Function declarations
-(declare-function treesit-language-available-p "treesit.c")
-(declare-function treesit-language-version "treesit.c")
-
-(declare-function treesit-parser-p "treesit.c")
-(declare-function treesit-node-p "treesit.c")
-(declare-function treesit-compiled-query-p "treesit.c")
-(declare-function treesit-query-p "treesit.c")
-(declare-function treesit-query-language "treesit.c")
-
-(declare-function treesit-node-parser "treesit.c")
-
-(declare-function treesit-parser-create "treesit.c")
-(declare-function treesit-parser-delete "treesit.c")
-(declare-function treesit-parser-list "treesit.c")
-(declare-function treesit-parser-buffer "treesit.c")
-(declare-function treesit-parser-language "treesit.c")
-(declare-function treesit-parser-tag "treesit.c")
-
-(declare-function treesit-parser-root-node "treesit.c")
-
-(declare-function treesit-parser-set-included-ranges "treesit.c")
-(declare-function treesit-parser-included-ranges "treesit.c")
-(declare-function treesit-parser-changed-ranges "treesit.c")
-(declare-function treesit-parser-add-notifier "treesit.c")
-
-(declare-function treesit-node-type "treesit.c")
-(declare-function treesit-node-start "treesit.c")
-(declare-function treesit-node-end "treesit.c")
-(declare-function treesit-node-string "treesit.c")
-(declare-function treesit-node-parent "treesit.c")
-(declare-function treesit-node-child "treesit.c")
-(declare-function treesit-node-check "treesit.c")
-(declare-function treesit-node-field-name-for-child "treesit.c")
-(declare-function treesit-node-child-count "treesit.c")
-(declare-function treesit-node-child-by-field-name "treesit.c")
-(declare-function treesit-node-next-sibling "treesit.c")
-(declare-function treesit-node-prev-sibling "treesit.c")
-(declare-function treesit-node-first-child-for-pos "treesit.c")
-(declare-function treesit-node-descendant-for-range "treesit.c")
-(declare-function treesit-node-eq "treesit.c")
-
-(declare-function treesit-pattern-expand "treesit.c")
-(declare-function treesit-query-expand "treesit.c")
-(declare-function treesit-query-compile "treesit.c")
-(declare-function treesit-query-capture "treesit.c")
-
-(declare-function treesit-search-subtree "treesit.c")
-(declare-function treesit-search-forward "treesit.c")
-(declare-function treesit-induce-sparse-tree "treesit.c")
-(declare-function treesit-subtree-stat "treesit.c")
-(declare-function treesit-node-match-p "treesit.c")
-
-(declare-function treesit-available-p "treesit.c")
-
-(defvar treesit-thing-settings)
+(defmacro treesit-declare-unavailable-functions ()
+ "Declare C functions and variables defined in treesit.c.
+
+This macro is only needed when a file needs to be able to byte-compile
+in a Emacs not built with tree-sitter library."
+ '(progn
+ (declare-function treesit-language-available-p "treesit.c")
+ (declare-function treesit-language-version "treesit.c")
+
+ (declare-function treesit-parser-p "treesit.c")
+ (declare-function treesit-node-p "treesit.c")
+ (declare-function treesit-compiled-query-p "treesit.c")
+ (declare-function treesit-query-p "treesit.c")
+ (declare-function treesit-query-language "treesit.c")
+
+ (declare-function treesit-node-parser "treesit.c")
+
+ (declare-function treesit-parser-create "treesit.c")
+ (declare-function treesit-parser-delete "treesit.c")
+ (declare-function treesit-parser-list "treesit.c")
+ (declare-function treesit-parser-buffer "treesit.c")
+ (declare-function treesit-parser-language "treesit.c")
+ (declare-function treesit-parser-tag "treesit.c")
+
+ (declare-function treesit-parser-root-node "treesit.c")
+
+ (declare-function treesit-parser-set-included-ranges "treesit.c")
+ (declare-function treesit-parser-included-ranges "treesit.c")
+ (declare-function treesit-parser-changed-ranges "treesit.c")
+ (declare-function treesit-parser-add-notifier "treesit.c")
+
+ (declare-function treesit-node-type "treesit.c")
+ (declare-function treesit-node-start "treesit.c")
+ (declare-function treesit-node-end "treesit.c")
+ (declare-function treesit-node-string "treesit.c")
+ (declare-function treesit-node-parent "treesit.c")
+ (declare-function treesit-node-child "treesit.c")
+ (declare-function treesit-node-check "treesit.c")
+ (declare-function treesit-node-field-name-for-child "treesit.c")
+ (declare-function treesit-node-child-count "treesit.c")
+ (declare-function treesit-node-child-by-field-name "treesit.c")
+ (declare-function treesit-node-next-sibling "treesit.c")
+ (declare-function treesit-node-prev-sibling "treesit.c")
+ (declare-function treesit-node-first-child-for-pos "treesit.c")
+ (declare-function treesit-node-descendant-for-range "treesit.c")
+ (declare-function treesit-node-eq "treesit.c")
+
+ (declare-function treesit-pattern-expand "treesit.c")
+ (declare-function treesit-query-expand "treesit.c")
+ (declare-function treesit-query-compile "treesit.c")
+ (declare-function treesit-query-capture "treesit.c")
+
+ (declare-function treesit-search-subtree "treesit.c")
+ (declare-function treesit-search-forward "treesit.c")
+ (declare-function treesit-induce-sparse-tree "treesit.c")
+ (declare-function treesit-subtree-stat "treesit.c")
+ (declare-function treesit-node-match-p "treesit.c")
+
+ (declare-function treesit-available-p "treesit.c")
+
+ (defvar treesit-thing-settings)))
+
+(treesit-declare-unavailable-functions)
;;; Custom options