From 07a8a8d396a91fd4b8dcb57cc98ef30784601ac3 Mon Sep 17 00:00:00 2001 From: Wilhelm H Kirschbaum Date: Mon, 13 Mar 2023 21:47:50 +0200 Subject: [PATCH] Fix elixir-ts-mode.elc warning (bug#62155) * lisp/progmodes/elixir-ts-mode.el: Only require heex-ts-mode once elixir-ts-mode loads to avoid calling (treesit-ready-p 'heex) during byte-compilation. --- lisp/progmodes/elixir-ts-mode.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/elixir-ts-mode.el b/lisp/progmodes/elixir-ts-mode.el index 8adf647b081..da83e7d6c5a 100644 --- a/lisp/progmodes/elixir-ts-mode.el +++ b/lisp/progmodes/elixir-ts-mode.el @@ -44,7 +44,6 @@ ;;; Code: (require 'treesit) -(require 'heex-ts-mode) (eval-when-compile (require 'rx)) (declare-function treesit-parser-create "treesit.c") @@ -480,6 +479,10 @@ elixir-ts--treesit-range-rules :host 'elixir '((sigil (sigil_name) @name (:match "^[HF]$" @name) (quoted_content) @heex))))) +(defvar heex-ts--sexp-regexp) +(defvar heex-ts--indent-rules) +(defvar heex-ts--font-lock-settings) + (defun elixir-ts--forward-sexp (&optional arg) "Move forward across one balanced expression (sexp). With ARG, do it many times. Negative ARG means move backward." @@ -566,8 +569,12 @@ elixir-ts-mode (when (treesit-ready-p 'elixir) ;; The HEEx parser has to be created first for elixir to ensure elixir ;; is the first language when looking for treesit ranges. - (if (treesit-ready-p 'heex) - (treesit-parser-create 'heex)) + (when (treesit-ready-p 'heex) + ;; Require heex-ts-mode only when we load elixir-ts-mode + ;; so that we don't get a tree-sitter compilation warning for + ;; elixir-ts-mode. + (require 'heex-ts-mode) + (treesit-parser-create 'heex)) (treesit-parser-create 'elixir) -- 2.39.2