GNU logs - #76788, boring messages


Message sent to wkirschbaum@HIDDEN, bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76788: treesit-thing-settings for elixir-ts-mode
Resent-From: Juri Linkov <juri@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: wkirschbaum@HIDDEN, bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 06 Mar 2025 18:18:01 +0000
Resent-Message-ID: <handler.76788.B.17412850304078 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 76788
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 76788 <at> debbugs.gnu.org
Cc: Wilhelm Kirschbaum <wkirschbaum@HIDDEN>
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
X-Debbugs-Original-Xcc: Wilhelm Kirschbaum <wkirschbaum@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.17412850304078
          (code B ref -1); Thu, 06 Mar 2025 18:18:01 +0000
Received: (at submit) by debbugs.gnu.org; 6 Mar 2025 18:17:10 +0000
Received: from localhost ([127.0.0.1]:45368 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tqFmQ-00013h-2e
	for submit <at> debbugs.gnu.org; Thu, 06 Mar 2025 13:17:10 -0500
Received: from lists.gnu.org ([2001:470:142::17]:44106)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1tqFmK-000136-7s
 for submit <at> debbugs.gnu.org; Thu, 06 Mar 2025 13:17:04 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1tqFmE-0004vg-OK
 for bug-gnu-emacs@HIDDEN; Thu, 06 Mar 2025 13:16:58 -0500
Received: from relay8-d.mail.gandi.net ([2001:4b98:dc4:8::228])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1tqFmC-000393-1k
 for bug-gnu-emacs@HIDDEN; Thu, 06 Mar 2025 13:16:58 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id 435784443B
 for <bug-gnu-emacs@HIDDEN>; Thu,  6 Mar 2025 18:16:49 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
Organization: LINKOV.NET
Date: Thu, 06 Mar 2025 20:12:12 +0200
Message-ID: <87o6yedo5f.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-GND-State: clean
X-GND-Score: 0
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddutdekgeehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecunecujfgurhephffvufhofffkfgggtgesmhdtreertdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeevteefieeuhfdtgeeuudekgfejjeekvddvvefhvdeftdeifeekveelieekffefudenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepuddprhgtphhtthhopegsuhhgqdhgnhhuqdgvmhgrtghssehgnhhurdhorhhg
X-GND-Sasl: juri@HIDDEN
Received-SPF: pass client-ip=2001:4b98:dc4:8::228;
 envelope-from=juri@HIDDEN; helo=relay8-d.mail.gandi.net
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)

--=-=-=
Content-Type: text/plain

Hi Wilhelm,

Currently I'm adding the new 'list' thing to all ts-modes
and noticed that elixir-ts-mode defines the function
'elixir-ts--forward-sexp'.

This function can be superseded by the 'list' definition
in treesit-thing-settings that supports such commands
as 'forward-sexp', 'forward-list', 'up-list', 'down-list',
and modes 'show-paren-mode', 'hs-minor-mode'.

I have tested all cases, and this patch covers all list nodes.
The only doubtful case is the commented out definition

  ;; (and "\\`call\\'" ,#'elixir-ts--defun-p)

When enabled, it causes too much trouble
with e.g. 'show-paren-mode', etc.
OTOH, this definition is not much needed since
'C-M-a' (beginning-of-defun) and 'C-M-e' (end-of-defun)
already cover this need instead of using 'C-M-f/b',
so 'C-M-a/e' could be used to navigate between functions.
And 'C-M-f/b' navigate in all other cases such as
between 'do' and 'end', parens, etc.

--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=elixir--ts--thing-settings.patch

diff --git a/lisp/progmodes/elixir-ts-mode.el b/lisp/progmodes/elixir-ts-mode.el
index d50692d87c0..e5a6448fc8f 100644
--- a/lisp/progmodes/elixir-ts-mode.el
+++ b/lisp/progmodes/elixir-ts-mode.el
@@ -111,13 +111,6 @@ elixir-ts-attribute
   "Face used for attributes in Elixir files."
   :group 'elixir-ts)
 
-(defconst elixir-ts--sexp-regexp
-  (rx bol
-      (or "call" "stab_clause" "binary_operator" "list" "tuple" "map" "pair"
-          "sigil" "string" "atom" "alias" "arguments" "identifier"
-          "boolean" "quoted_content" "bitstring")
-      eol))
-
 (defconst elixir-ts--test-definition-keywords
   '("describe" "test"))
 
@@ -574,21 +567,10 @@ elixir-ts--treesit-range-rules
               (:match "^[HF]$" @_name)
               (quoted_content) @heex)))))
 
-(defvar heex-ts--sexp-regexp)
+(defvar heex-ts--thing-settings)
 (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."
-  (or arg (setq arg 1))
-  (funcall
-   (if (> arg 0) #'treesit-end-of-thing #'treesit-beginning-of-thing)
-   (if (eq (treesit-language-at (point)) 'heex)
-       heex-ts--sexp-regexp
-     elixir-ts--sexp-regexp)
-   (abs arg)))
-
 (defun elixir-ts--treesit-anchor-grand-parent-bol (_n parent &rest _)
   "Return the beginning of non-space characters for the parent node of PARENT."
   (save-excursion
@@ -636,6 +618,14 @@ elixir-ts--defun-name
                 (_ nil))))
     (_ nil)))
 
+(defun elixir-ts--with-parens-0-p (node)
+  (equal (treesit-node-type (treesit-node-child node 0))
+         "("))
+
+(defun elixir-ts--with-parens-1-p (node)
+  (equal (treesit-node-type (treesit-node-child node 1))
+         "("))
+
 (defvar elixir-ts--syntax-propertize-query
   (when (treesit-available-p)
     (treesit-query-compile
@@ -722,7 +712,30 @@ elixir-ts-mode
     (setq-local treesit-simple-indent-rules elixir-ts--indent-rules)
 
     ;; Navigation.
-    (setq-local forward-sexp-function #'elixir-ts--forward-sexp)
+    (setq-local treesit-thing-settings
+                `((elixir
+                   (list
+                    (or ;; (and "\\`call\\'" ,#'elixir-ts--defun-p)
+                        (and "\\`arguments\\'" ,#'elixir-ts--with-parens-0-p)
+                        (and "\\`unary_operator\\'" ,#'elixir-ts--with-parens-1-p)
+                        ,(rx bos (or "block"
+                                     "quoted_atom"
+                                     "string"
+                                     "interpolation"
+                                     "sigil"
+                                     "quoted_keyword"
+                                     "list"
+                                     "tuple"
+                                     "bitstring"
+                                     "map"
+                                     "do_block"
+                                     "anonymous_function")
+                             eos)))
+                   (sentence
+                    ,(rx bos (or "call") eos))
+                   (text
+                    ,(rx bos (or "string" "sigil" "comment") eos)))
+                  (heex ,@heex-ts--thing-settings)))
     (setq-local treesit-defun-type-regexp
                 '("call" . elixir-ts--defun-p))
 
diff --git a/lisp/progmodes/heex-ts-mode.el b/lisp/progmodes/heex-ts-mode.el
index 65aaa0d488d..88f58041c1b 100644
--- a/lisp/progmodes/heex-ts-mode.el
+++ b/lisp/progmodes/heex-ts-mode.el
@@ -56,12 +56,6 @@ heex-ts-indent-offset
   :safe 'integerp
   :group 'heex-ts)
 
-(defconst heex-ts--sexp-regexp
-  (rx bol
-      (or "directive" "tag" "component" "slot"
-          "attribute" "attribute_value" "quoted_attribute_value" "expression")
-      eol))
-
 ;; There seems to be no parent directive block for tree-sitter-heex,
 ;; so we ignore them for now until we learn how to query them.
 ;; https://github.com/phoenixframework/tree-sitter-heex/issues/28
@@ -139,14 +133,24 @@ heex-ts--defun-name
        (treesit-node-child (treesit-node-child node 0) 1) nil)))
     (_ nil)))
 
-(defun heex-ts--forward-sexp (&optional arg)
-  "Move forward across one balanced expression (sexp).
-With ARG, do it many times.  Negative ARG means move backward."
-  (or arg (setq arg 1))
-  (funcall
-   (if (> arg 0) #'treesit-end-of-thing #'treesit-beginning-of-thing)
-   heex-ts--sexp-regexp
-   (abs arg)))
+(defvar heex-ts--thing-settings
+  `((list
+     ,(rx bos (or "doctype"
+                  "tag"
+                  "component"
+                  "slot"
+                  "expression"
+                  "directive"
+                  "comment")
+          eos))
+    (sentence
+     ,(rx bos (or "tag_name"
+                  "component_name"
+                  "attribute")
+          eos))
+    (text
+     ,(rx bos (or "comment" "text") eos)))
+  "`treesit-thing-settings' for HEEx.")
 
 ;;;###autoload
 (define-derived-mode heex-ts-mode html-mode "HEEx"
@@ -158,10 +162,7 @@ heex-ts-mode
 
     ;; Comments
     (setq-local treesit-thing-settings
-                `((heex
-                   (text ,(regexp-opt '("comment" "text"))))))
-
-    (setq-local forward-sexp-function #'heex-ts--forward-sexp)
+                `((heex ,@heex-ts--thing-settings)))
 
     ;; Navigation.
     (setq-local treesit-defun-type-regexp

--=-=-=--




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Juri Linkov <juri@HIDDEN>
Subject: bug#76788: Acknowledgement (treesit-thing-settings for
 elixir-ts-mode)
Message-ID: <handler.76788.B.17412850304078.ack <at> debbugs.gnu.org>
References: <87o6yedo5f.fsf@HIDDEN>
X-Gnu-PR-Message: ack 76788
X-Gnu-PR-Package: emacs
Reply-To: 76788 <at> debbugs.gnu.org
Date: Thu, 06 Mar 2025 18:18:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

As you requested using X-Debbugs-CC, your message was also forwarded to
  Wilhelm Kirschbaum <wkirschbaum@HIDDEN>
(after having been given a bug report number, if it did not have one).

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 76788 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
76788: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D76788
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76788: treesit-thing-settings for elixir-ts-mode
Resent-From: Wilhelm Kirschbaum <wkirschbaum@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 10 Mar 2025 06:41:02 +0000
Resent-Message-ID: <handler.76788.B76788.174158880620676 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76788
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Juri Linkov <juri@HIDDEN>
Cc: 76788 <at> debbugs.gnu.org
Received: via spool by 76788-submit <at> debbugs.gnu.org id=B76788.174158880620676
          (code B ref 76788); Mon, 10 Mar 2025 06:41:02 +0000
Received: (at 76788) by debbugs.gnu.org; 10 Mar 2025 06:40:06 +0000
Received: from localhost ([127.0.0.1]:36049 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1trWo1-0005N5-JJ
	for submit <at> debbugs.gnu.org; Mon, 10 Mar 2025 02:40:06 -0400
Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]:52310)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <wkirschbaum@HIDDEN>)
 id 1trWnz-0005Ko-Uw
 for 76788 <at> debbugs.gnu.org; Mon, 10 Mar 2025 02:40:04 -0400
Received: by mail-qt1-x835.google.com with SMTP id
 d75a77b69052e-4768f90bf36so3054441cf.0
 for <76788 <at> debbugs.gnu.org>; Sun, 09 Mar 2025 23:40:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1741588798; x=1742193598; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=im8cmjj5aTyuxtFwUZlAL9RE+HTqp4/eYwLn7+xhyWU=;
 b=Ll8fMIe+FUNkz9Vt6Qooo95ullY0Caquwmg2f7obUQETJYtZbUL3d1EJ08vckfeESY
 ntdrH3uOAWzPWrqhwn9VMl8MaIkl1Roy2sAaGBO7xuQ7C37oJvrD0QcqG9HgHjVnP0WY
 0APhgt12y1D+Z47vig8mgK5K8InqHx4ZfDYSNk99nyCwoCsnjxA6kGVWbvS+E39Ktq2+
 LGErYTlTWGCEGx3x0h9UQe6Gf71kZ9q8P10Z9b4TCOrYq5zvY+eRKPDIgBRvv/gucA1V
 U59wrVI2v9gPORlujWIR5DHoVX4EjvbgvLTuEafG4pOI+MDpRp4ozfKPuzriIUviwcZi
 kMHQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1741588798; x=1742193598;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=im8cmjj5aTyuxtFwUZlAL9RE+HTqp4/eYwLn7+xhyWU=;
 b=R5Sl097/bRtLHeCn3AlKSGId7v4C9SwYnz9P1eg+FHxdhEMCrJ7Qzy/yRcvau0iXJQ
 aKI91FhNXwTOT/r9AYpz/2UHxgdAlhsVnqd6EuvBjDDg+t80fN8RXnGobVSe3acFFGeP
 V30ew7zih2mlZ08+h0oIZUsEirgGkkgTEcurz8rJLsr5SPyuWsnTBxzfMDXZtlx+grf6
 tKFVvEHrQ9xLn1eH5GiirC+lRjIt+1HMHmDPlZ/ItqgE5rpBvw+j9ttn82xXGwJhVzDU
 ukXVxlR+btM1IFqKygMIyP5p8H2kJghGcOWpOxR0eQkU4H3k+CvBWmR9XD3trD+1jddq
 3gPQ==
X-Gm-Message-State: AOJu0YxjAdaT0JablvBORjHu3PFe8wesrUwvvlymT1Tqc+EraYX6mrmD
 7p7QNrg+49tX2C5r6AOzXqeIMc/vzfvxadvluPbMcpa8tVDCPzgTeB2y+odGQOGK1wyPHRpjYDf
 eZdl2bHf6nhPEHjaghmeeYBps/kQ=
X-Gm-Gg: ASbGncvrFHqR0m8U6tb35zk5yt5uJ27CvKS4g85c63Qj1vr0y3BPAiyR8NdjoqLHOee
 0o92E5JXklvWD6X2cZaplNqiwGs4KqSDm3yneJ4laPeKbXXnkHPmRSlM15jeys4P2r9z3HT4ilz
 MPXwO9Erv84+nFoUTam6qdNpNmOJk=
X-Google-Smtp-Source: AGHT+IFK/mRfuWQhqXVrQ6LVQ2i4nK3nml8EzPwfXIzee/I1OFRRdqt6mNw9Cq3Q/ra/uVhLkBfKwZn/+bUNsqxM13s=
X-Received: by 2002:a05:622a:1a23:b0:475:b05:5050 with SMTP id
 d75a77b69052e-47618af6c28mr165376211cf.49.1741588797302; Sun, 09 Mar 2025
 23:39:57 -0700 (PDT)
MIME-Version: 1.0
References: <87o6yedo5f.fsf@HIDDEN>
In-Reply-To: <87o6yedo5f.fsf@HIDDEN>
From: Wilhelm Kirschbaum <wkirschbaum@HIDDEN>
Date: Mon, 10 Mar 2025 08:39:46 +0200
X-Gm-Features: AQ5f1JrKZXZJzbA1inmGpb0HA-fGuvf0lw6cPvcEY3slrgn4KbdN_CCQcXgc2Gk
Message-ID: <CAOS0-35EPsQyrxohoDWDR0aSrNh6jexs+vKU26b-F8YcoM7sXA@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000009badb5062ff73d84"
X-Spam-Score: 0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)

--0000000000009badb5062ff73d84
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Thanks Juri,

I will have a look at this early this week. The forward-sexp was added very
early, so there is perhaps a better way now.



On Thu, Mar 6, 2025 at 8:18=E2=80=AFPM Juri Linkov <juri@HIDDEN> wrote:

> Hi Wilhelm,
>
> Currently I'm adding the new 'list' thing to all ts-modes
> and noticed that elixir-ts-mode defines the function
> 'elixir-ts--forward-sexp'.
>
> This function can be superseded by the 'list' definition
> in treesit-thing-settings that supports such commands
> as 'forward-sexp', 'forward-list', 'up-list', 'down-list',
> and modes 'show-paren-mode', 'hs-minor-mode'.
>
> I have tested all cases, and this patch covers all list nodes.
> The only doubtful case is the commented out definition
>
>   ;; (and "\\`call\\'" ,#'elixir-ts--defun-p)
>
> When enabled, it causes too much trouble
> with e.g. 'show-paren-mode', etc.
> OTOH, this definition is not much needed since
> 'C-M-a' (beginning-of-defun) and 'C-M-e' (end-of-defun)
> already cover this need instead of using 'C-M-f/b',
> so 'C-M-a/e' could be used to navigate between functions.
> And 'C-M-f/b' navigate in all other cases such as
> between 'do' and 'end', parens, etc.
>

--0000000000009badb5062ff73d84
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Thanks Juri,=C2=A0<div><br></div><div>I will have a look a=
t this early this week. The forward-sexp was added very early, so there is =
perhaps a better way now.=C2=A0</div><div><br></div><div>=C2=A0</div></div>=
<br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Thu=
, Mar 6, 2025 at 8:18=E2=80=AFPM Juri Linkov &lt;<a href=3D"mailto:juri@lin=
kov.net" target=3D"_blank">juri@HIDDEN</a>&gt; wrote:<br></div><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px=
 solid rgb(204,204,204);padding-left:1ex">Hi Wilhelm,<br>
<br>
Currently I&#39;m adding the new &#39;list&#39; thing to all ts-modes<br>
and noticed that elixir-ts-mode defines the function<br>
&#39;elixir-ts--forward-sexp&#39;.<br>
<br>
This function can be superseded by the &#39;list&#39; definition<br>
in treesit-thing-settings that supports such commands<br>
as &#39;forward-sexp&#39;, &#39;forward-list&#39;, &#39;up-list&#39;, &#39;=
down-list&#39;,<br>
and modes &#39;show-paren-mode&#39;, &#39;hs-minor-mode&#39;.<br>
<br>
I have tested all cases, and this patch covers all list nodes.<br>
The only doubtful case is the commented out definition<br>
<br>
=C2=A0 ;; (and &quot;\\`call\\&#39;&quot; ,#&#39;elixir-ts--defun-p)<br>
<br>
When enabled, it causes too much trouble<br>
with e.g. &#39;show-paren-mode&#39;, etc.<br>
OTOH, this definition is not much needed since<br>
&#39;C-M-a&#39; (beginning-of-defun) and &#39;C-M-e&#39; (end-of-defun)<br>
already cover this need instead of using &#39;C-M-f/b&#39;,<br>
so &#39;C-M-a/e&#39; could be used to navigate between functions.<br>
And &#39;C-M-f/b&#39; navigate in all other cases such as<br>
between &#39;do&#39; and &#39;end&#39;, parens, etc.<br>
</blockquote></div>

--0000000000009badb5062ff73d84--




Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 10 Mar 2025 21:07:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 10 17:07:47 2025
Received: from localhost ([127.0.0.1]:40118 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1trkLj-0003rB-27
	for submit <at> debbugs.gnu.org; Mon, 10 Mar 2025 17:07:47 -0400
Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]:57403)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1trkLg-0003qo-QM
 for control <at> debbugs.gnu.org; Mon, 10 Mar 2025 17:07:45 -0400
Received: by mail-ed1-x52a.google.com with SMTP id
 4fb4d7f45d1cf-5e677f59438so2981295a12.2
 for <control <at> debbugs.gnu.org>; Mon, 10 Mar 2025 14:07:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1741640858; x=1742245658; darn=debbugs.gnu.org;
 h=to:subject:message-id:date:mime-version:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=EEMYxJUxuWGkXPzXs7ROVM1L07vpHS9Z81LPZo3LeSI=;
 b=H70eVLoHXUQLIzTo0P5UeMMEbbdGurn1eyK4yY797JfAzS7HQVeuX9Y5wOHCue71bB
 46uecCgPmjHpo9unmqyCYDv1AeE+kB913irUcDEVGQuAmDGwgyGELpBdoNaizuxoGtkb
 9eeEmxZJ26tP9WfncMo3ajObNUCkK8pAbshrP+RjSQx4k2PP1rRmbj0P3ACAGD/1ReTw
 97CM9cIO4YJOUBfdxuY6xGOtZkRHtFW0mEw5VjRAHRApNDK8G4pbc6p8vcwsRVtPl9nw
 f95nIEcjCZKhkLAv40ZWP054fCsnSd8quablA1KZ235jSZz34kAJPaUEBe8paeNcXyIL
 gOCQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1741640858; x=1742245658;
 h=to:subject:message-id:date:mime-version:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=EEMYxJUxuWGkXPzXs7ROVM1L07vpHS9Z81LPZo3LeSI=;
 b=K+vhxWIxOg+mv09gw41gzBfVoqww6No1M1hV1SoEzMVVUJrgSESvfyhqyp2HyeCYVy
 Hb7FNOKHl/0IkQafbvpdxb2TYrOjyHazS/Vu2YWnCeRfiS6yzSfQ6XSeZ9wmM3YLsn6U
 7ujyxEhQO5AGO+y0D1rPaPTVSRFnI+Od3M35hhjf/m3mHlIochxZ4PBBMfmBS3co2m2u
 rCaCR2ry8mX9/qQK5ekkHZ1181tPF7reFwrHGbiPgyh7Tor7kgkCF23Eqi2jnqHN7uI8
 xWTQapy7KhU6cMwHb0u6PphufVt4NuVu0brtSvxn4FEzZo7YshNlnzJ6ecPju9NfZ2Pu
 zw8w==
X-Gm-Message-State: AOJu0Yygx5kqIHuP8CKVkUmkAWqA4suIbDIiqAu9sntqYlFY1ehTMbs0
 WnNNWtaNyUqsGCy6T4IcsfhFFFZHuuvr1O3nRUY96lyxLhvOHGsR6GOTh1mbAQARAtYBnxpho32
 XD1qnijLpan6ebBblRKP+ORxxxveQWtzC
X-Gm-Gg: ASbGncvg1q4gSDEMAw/2LtwDEYTLN9jyes4T/gIgyoxQBP4dk/KBl7id2xZpuDiHuHA
 hOPiOu4XuIRsg3mZXfQbCZC26RXvzoh1YsPYL7WLr5Nlu3qgY5cbpbTMnB6tH88mkUb1amDSaow
 aBSLHBOHOmMlaw8bfwj/r9FHdL4/0=
X-Google-Smtp-Source: AGHT+IE/fDXgZPuH2ssVzagcLQkDnAxLaiKud9g/Xi2UyAyQeW951fR9Lg6LbVsmqdolrvJlgkFd9C0dnYI1+26/vaM=
X-Received: by 2002:a05:6402:34c8:b0:5dc:ebb8:fe64 with SMTP id
 4fb4d7f45d1cf-5e5e22daa95mr15426770a12.14.1741640858467; Mon, 10 Mar 2025
 14:07:38 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Mon, 10 Mar 2025 17:07:38 -0400
From: Stefan Kangas <stefankangas@HIDDEN>
MIME-Version: 1.0
Date: Mon, 10 Mar 2025 17:07:38 -0400
X-Gm-Features: AQ5f1JqPFpiKRuOmSnr2v0wI-gRjzpuf5WNVhInVD5HMafzfxqCL65vSdS_F6KE
Message-ID: <CADwFkmng==a9bioncQZoq-hzha8-911SbCNCcS31eGuTx_Dteg@HIDDEN>
Subject: control message for bug #76788
To: control <at> debbugs.gnu.org
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

severity 76788 wishlist
quit




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#76788: treesit-thing-settings for elixir-ts-mode
Resent-From: Juri Linkov <juri@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 10 Apr 2025 16:38:02 +0000
Resent-Message-ID: <handler.76788.B76788.174430305811677 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76788
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Wilhelm Kirschbaum <wkirschbaum@HIDDEN>
Cc: 76788 <at> debbugs.gnu.org
Received: via spool by 76788-submit <at> debbugs.gnu.org id=B76788.174430305811677
          (code B ref 76788); Thu, 10 Apr 2025 16:38:02 +0000
Received: (at 76788) by debbugs.gnu.org; 10 Apr 2025 16:37:38 +0000
Received: from localhost ([127.0.0.1]:46507 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u2uuH-00032F-Lm
	for submit <at> debbugs.gnu.org; Thu, 10 Apr 2025 12:37:37 -0400
Received: from relay5-d.mail.gandi.net ([217.70.183.197]:46673)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>)
 id 1u2uuB-00031l-RN; Thu, 10 Apr 2025 12:37:32 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 3E5A042EF2;
 Thu, 10 Apr 2025 16:37:23 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
In-Reply-To: <CAOS0-35EPsQyrxohoDWDR0aSrNh6jexs+vKU26b-F8YcoM7sXA@HIDDEN>
Organization: LINKOV.NET
References: <87o6yedo5f.fsf@HIDDEN>
 <CAOS0-35EPsQyrxohoDWDR0aSrNh6jexs+vKU26b-F8YcoM7sXA@HIDDEN>
Date: Thu, 10 Apr 2025 19:35:03 +0300
Message-ID: <87v7rc2cw8.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvtdelgeduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepfedprhgtphhtthhopegtohhnthhrohhlseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepjeeijeekkeesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopeifkhhirhhstghhsggruhhmsehgmhgrihhlrdgtohhm
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

close 76788 31.0.50
thanks

On Mon, Mar 10 2025, Wilhelm Kirschbaum wrote:

> I will have a look at this early this week. The forward-sexp was added very
> early, so there is perhaps a better way now.

Indeed, there is a better way now, so I adapted it.

BTW, I was a surprise that only elixir can embed heex,
but not vice versa.  So I tried to embed elixir in heex
using injections.scm queries from tree-sitter-heex repo:

#+begin_src emacs-lisp
(define-derived-mode heex-ts-mode html-mode "HEEx"
  ...
  (setq-local treesit-range-settings
              (treesit-range-rules
               :embed 'elixir
               :host 'heex
               '((directive [(partial_expression_value)
                             (ending_expression_value)]
                            @cap))

               :embed 'elixir
               :host 'heex
               :local t
               '((directive (expression_value) @cap)
                 (expression (expression_value) @cap))))
#+end_src

together with combined treesit-font-lock-settings/feature-list.
And these ranges work nicely only separately, but not when combined.
So need to investigate more.  Maybe will create a new report.




Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 10 Apr 2025 16:37:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 10 12:37:38 2025
Received: from localhost ([127.0.0.1]:46509 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u2uuI-00032N-19
	for submit <at> debbugs.gnu.org; Thu, 10 Apr 2025 12:37:38 -0400
Received: from relay5-d.mail.gandi.net ([217.70.183.197]:46673)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>)
 id 1u2uuB-00031l-RN; Thu, 10 Apr 2025 12:37:32 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 3E5A042EF2;
 Thu, 10 Apr 2025 16:37:23 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Wilhelm Kirschbaum <wkirschbaum@HIDDEN>
Subject: Re: bug#76788: treesit-thing-settings for elixir-ts-mode
In-Reply-To: <CAOS0-35EPsQyrxohoDWDR0aSrNh6jexs+vKU26b-F8YcoM7sXA@HIDDEN>
Organization: LINKOV.NET
References: <87o6yedo5f.fsf@HIDDEN>
 <CAOS0-35EPsQyrxohoDWDR0aSrNh6jexs+vKU26b-F8YcoM7sXA@HIDDEN>
Date: Thu, 10 Apr 2025 19:35:03 +0300
Message-ID: <87v7rc2cw8.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvtdelgeduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepfedprhgtphhtthhopegtohhnthhrohhlseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepjeeijeekkeesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopeifkhhirhhstghhsggruhhmsehgmhgrihhlrdgtohhm
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: control
Cc: 76788 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

close 76788 31.0.50
thanks

On Mon, Mar 10 2025, Wilhelm Kirschbaum wrote:

> I will have a look at this early this week. The forward-sexp was added very
> early, so there is perhaps a better way now.

Indeed, there is a better way now, so I adapted it.

BTW, I was a surprise that only elixir can embed heex,
but not vice versa.  So I tried to embed elixir in heex
using injections.scm queries from tree-sitter-heex repo:

#+begin_src emacs-lisp
(define-derived-mode heex-ts-mode html-mode "HEEx"
  ...
  (setq-local treesit-range-settings
              (treesit-range-rules
               :embed 'elixir
               :host 'heex
               '((directive [(partial_expression_value)
                             (ending_expression_value)]
                            @cap))

               :embed 'elixir
               :host 'heex
               :local t
               '((directive (expression_value) @cap)
                 (expression (expression_value) @cap))))
#+end_src

together with combined treesit-font-lock-settings/feature-list.
And these ranges work nicely only separately, but not when combined.
So need to investigate more.  Maybe will create a new report.





Last modified: Thu, 10 Apr 2025 16:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.