These are autodefs, meaning they should be defined whether or not the containing module is enabled, but they should no-op when it's disabled, by defining a no-op macro with the same name. However, lsp! and tree-sitter! are meant to be used as hooks, and you can't use macros as hooks, so you get void-function errors when they are used as such. This ensures they are properly defined as no-op functions in those cases. I.e. ;;;###autodef FORM FORM is used instead of a no-op macro if the parent module is disabled.
22 lines
928 B
EmacsLisp
22 lines
928 B
EmacsLisp
;;; tools/tree-sitter/autoload.el -*- lexical-binding: t; -*-
|
|
|
|
;;;###autodef (fset 'tree-sitter! #'ignore)
|
|
(defun tree-sitter! ()
|
|
(interactive)
|
|
(turn-on-tree-sitter-mode))
|
|
|
|
;; HACK: Remove and refactor when `use-package' eager macro expansion is solved or `use-package!' is removed
|
|
;;;###autoload
|
|
(defun +tree-sitter-get-textobj (group &optional query)
|
|
"A wrapper around `evil-textobj-tree-sitter-get-textobj' to
|
|
prevent eager expansion."
|
|
(eval `(evil-textobj-tree-sitter-get-textobj ,group ,query)))
|
|
|
|
;;;###autoload
|
|
(defun +tree-sitter-goto-textobj (group &optional previous end query)
|
|
"Thin wrapper that returns the symbol of a named function, used in keybindings."
|
|
(let ((sym (intern (format "+goto%s%s-%s" (if previous "-previous" "") (if end "-end" "") group))))
|
|
(fset sym (lambda ()
|
|
(interactive)
|
|
(evil-textobj-tree-sitter-goto-textobj group previous end query)))
|
|
sym))
|