unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Wilhelm Kirschbaum <wkirschbaum@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: ruijie@netyu.xyz, luangruo@yahoo.com, 62155@debbugs.gnu.org
Subject: bug#62155: 30.0.50; elixir-ts-mode.elc warning
Date: Mon, 13 Mar 2023 22:07:27 +0200	[thread overview]
Message-ID: <87fsa8be46.fsf@gmail.com> (raw)
In-Reply-To: <83fsa8u3f5.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 654 bytes --]


Eli Zaretskii <eliz@gnu.org> writes:

>> Cc: luangruo@yahoo.com, 62155@debbugs.gnu.org
>> From: Wilhelm Kirschbaum <wkirschbaum@gmail.com>
>> Date: Mon, 13 Mar 2023 15:08:10 +0200
>> 
>> I can see there is still an issue with loading heex-ts-mode 
>> from 
>> elixir-ts-mode, but not quite sure how to
>> immediately resolve it. I will have a look in a couple of 
>> hours.
>
> One possibility is to add defvar for each variable defined by
> heex-ts-mode that elixir-ts-mode needs to use, and remove the 
> require
> of heex-ts-mode.  Since heex-ts-mode is loaded at run time, I 
> think
> this should be enough.
>

Thank you, this seems to work well.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Fix elixir-ts-mode.elc warning --]
[-- Type: text/x-patch, Size: 1878 bytes --]

From 07a8a8d396a91fd4b8dcb57cc98ef30784601ac3 Mon Sep 17 00:00:00 2001
From: Wilhelm H Kirschbaum <wkirschbaum@gmail.com>
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


  reply	other threads:[~2023-03-13 20:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <877cvl9zgl.fsf.ref@yahoo.com>
2023-03-13  2:06 ` bug#62155: 30.0.50; elixir-ts-mode.elc warning Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-13 11:03   ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-13 13:08     ` Wilhelm Kirschbaum
2023-03-13 14:33       ` Eli Zaretskii
2023-03-13 20:07         ` Wilhelm Kirschbaum [this message]
2023-03-16  7:53           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fsa8be46.fsf@gmail.com \
    --to=wkirschbaum@gmail.com \
    --cc=62155@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=luangruo@yahoo.com \
    --cc=ruijie@netyu.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).