From 5e99e307b95c9f363fbc11fb57c175c80f6e7e9d Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 27 Sep 2024 20:51:55 +0200 Subject: Autoload adding gsp to ‘auto-mode-alist’ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gsp-ts-mode.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/gsp-ts-mode.el b/gsp-ts-mode.el index 3bbb45f..100aedf 100644 --- a/gsp-ts-mode.el +++ b/gsp-ts-mode.el @@ -25,6 +25,13 @@ ;;; Code: +(unless (treesit-available-p) + (error "Tree-Sitter support is required for `gsp-ts-mode'")) +(require 'treesit) + +;;;###autoload +(add-to-list 'auto-mode-alist '("\\.gsp\\'" . gsp-ts-mode)) + (defcustom gsp-ts-mode-indent-offset 2 "Number of spaces for each indentation step in `gsp-ts-mode'." :version "1.0.0" @@ -112,11 +119,5 @@ See the documentation for `treesit-simple-indent-rules' and (treesit-parser-create 'gsp) (gsp-ts--setup)) -(unless (treesit-available-p) - (error "Tree-Sitter support is required for `gsp-ts-mode'")) -(require 'treesit) -(when (treesit-ready-p 'gsp) - (add-to-list 'auto-mode-alist '("\\.gsp\\'" . gsp-ts-mode))) - (provide 'gsp-ts-mode) ;;; gsp-ts-mode.el ends here -- cgit v1.2.3