From unknown Thu Aug 14 21:55:39 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#76788 <76788@debbugs.gnu.org> To: bug#76788 <76788@debbugs.gnu.org> Subject: Status: treesit-thing-settings for elixir-ts-mode Reply-To: bug#76788 <76788@debbugs.gnu.org> Date: Fri, 15 Aug 2025 04:55:39 +0000 retitle 76788 treesit-thing-settings for elixir-ts-mode reassign 76788 emacs submitter 76788 Juri Linkov severity 76788 wishlist thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 06 13:17:10 2025 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 ) id 1tqFmQ-00013h-2e for submit@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 ) id 1tqFmK-000136-7s for submit@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 ) id 1tqFmE-0004vg-OK for bug-gnu-emacs@gnu.org; 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 ) id 1tqFmC-000393-1k for bug-gnu-emacs@gnu.org; Thu, 06 Mar 2025 13:16:58 -0500 Received: by mail.gandi.net (Postfix) with ESMTPSA id 435784443B for ; Thu, 6 Mar 2025 18:16:49 +0000 (UTC) From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: treesit-thing-settings for elixir-ts-mode Organization: LINKOV.NET X-Debbugs-Cc: Wilhelm Kirschbaum Date: Thu, 06 Mar 2025 20:12:12 +0200 Message-ID: <87o6yedo5f.fsf@mail.linkov.net> 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@linkov.net Received-SPF: pass client-ip=2001:4b98:dc4:8::228; envelope-from=juri@linkov.net; 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-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 10 02:40:06 2025 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 ) id 1trWo1-0005N5-JJ for submit@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 ) id 1trWnz-0005Ko-Uw for 76788@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@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@mail.linkov.net> In-Reply-To: <87o6yedo5f.fsf@mail.linkov.net> From: Wilhelm Kirschbaum Date: Mon, 10 Mar 2025 08:39:46 +0200 X-Gm-Features: AQ5f1JrKZXZJzbA1inmGpb0HA-fGuvf0lw6cPvcEY3slrgn4KbdN_CCQcXgc2Gk Message-ID: Subject: Re: bug#76788: treesit-thing-settings for elixir-ts-mode To: Juri Linkov Content-Type: multipart/alternative; boundary="0000000000009badb5062ff73d84" X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 76788 Cc: 76788@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 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
Thanks Juri,=C2=A0

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

=C2=A0
=
On Thu= , Mar 6, 2025 at 8:18=E2=80=AFPM Juri Linkov <juri@linkov.net> 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

=C2=A0 ;; (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-- From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 10 17:07:47 2025 Received: (at control) by debbugs.gnu.org; 10 Mar 2025 21:07:47 +0000 Received: from localhost ([127.0.0.1]:40118 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1trkLj-0003rB-27 for submit@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 ) id 1trkLg-0003qo-QM for control@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 ; 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 MIME-Version: 1.0 Date: Mon, 10 Mar 2025 17:07:38 -0400 X-Gm-Features: AQ5f1JqPFpiKRuOmSnr2v0wI-gRjzpuf5WNVhInVD5HMafzfxqCL65vSdS_F6KE Message-ID: Subject: control message for bug #76788 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) severity 76788 wishlist quit From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 10 12:37:37 2025 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 ) id 1u2uuH-00032F-Lm for submit@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 ) 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 To: Wilhelm Kirschbaum Subject: Re: bug#76788: treesit-thing-settings for elixir-ts-mode In-Reply-To: Organization: LINKOV.NET References: <87o6yedo5f.fsf@mail.linkov.net> Date: Thu, 10 Apr 2025 19:35:03 +0300 Message-ID: <87v7rc2cw8.fsf@mail.linkov.net> 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@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 76788 Cc: 76788@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 15 03:01:13 2025 Received: (at 76788) by debbugs.gnu.org; 15 Apr 2025 07:01:14 +0000 Received: from localhost ([127.0.0.1]:50263 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u4aID-00037q-Gm for submit@debbugs.gnu.org; Tue, 15 Apr 2025 03:01:13 -0400 Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]:57511) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1u4aI9-00037U-GH for 76788@debbugs.gnu.org; Tue, 15 Apr 2025 03:01:12 -0400 Received: by mail-qt1-x833.google.com with SMTP id d75a77b69052e-47686580529so54795581cf.2 for <76788@debbugs.gnu.org>; Tue, 15 Apr 2025 00:01:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744700463; x=1745305263; darn=debbugs.gnu.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=x/lLMX8yuUF0K9mjES8ZcDKT/yjqziiVTcDIgES8wBE=; b=bluOi6bRtOkGCWRGhlkuncmVLSVzsL67vHByD0xwSNs9xKDjHrJSfr9AaIG/cQBizG sd2EujJ3IflqWQKqx0xQFrcwmPaSzyzZhDeVZdOBPC0twom0lMHwR0hV+ackqzAO7Lyp 13iQHKSd9dV10MF74uICbb3la4rQyhX/hehQgy6R6QYYpKW62cL6x1wwOJDh87NRwFnj gR86TnFxW4tL0LuFuJXi2QuP4ekkbgES+QrTe2zaVsKaXWfNDfQ+djmxRUsu+BP8l13m fVVonYJv+H4Q0uygOj+ZIdVJv1y4wTrT8pDyHUPxvw8TejfKoj4Klc4E0wAYqGhm7lWr dwGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744700463; x=1745305263; h=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=x/lLMX8yuUF0K9mjES8ZcDKT/yjqziiVTcDIgES8wBE=; b=NB1Rl0GOeOquu6Pc3xnoKdQjAMqg/ffyyzTgiwcHSbBOSlhoS5oymQhAePJdo4cKb8 pkcZwvCJrti9quPZwPRb/tc+LVgt2xFaC6ifgLfRKXjhFygrEWKVqBvm1jRx1yzA/0Hz PT7WvB9bnsVFbsxWHk6unUNxdGO52Q1n9xpxQoUrlKMk1cO62ljlh7Zxv3zQFrrDuXhM T4D3Yd05apurvHPRPUS81GfCPIt8tiALY6M4cgzx2dwZOfXeBFIAo5fAovanmvQLu1nJ KwWnfLME1ev9aH+YXgXTKszLOIsAEGcQop4fWY2J46IAXvJ9ttNXFuL0y2gHY8mU3v6C fQHg== X-Forwarded-Encrypted: i=1; AJvYcCX7lXqfMrdZ+w6JQWgZAZQElVhtFXnn7HsepCf5rP4u20Ycpl3SqaUqSoQZ0o+4Cwhz9IYjMQ==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yz21rMkyOz2FqZLCEjPDOgI8nRSQSG+WGqBm5Vtw/cSAjbR+PRT OfWWExiJKIJbHTin4S2YWGf4S83ePodRpdBdTlJlpkrXxO383mvakaaMm9feKIU4HtzhTbowpMQ bSDRRH8LcoMQs8+1dfeMVFkOtyL3F1eJr X-Gm-Gg: ASbGncuAcCWsUHFLjlAavze2tz6NaASTmxXWPI5GhXFdWMWLkOX+exPHMDT5owxR7Ju MnBBp1LZ6OtLpH1DOIHQOwq3h7efEnqmRDUSBB/5b8VnZ+F9AmKXw+b+1nkDCDcT4hXjNk3md4Q VAhlvsv1zAUxxJgv3wYFEro78= X-Google-Smtp-Source: AGHT+IG+0+AVMsOeScYyovpPIIyVKETp+TKoVQYoaAS22NBPM91u/FTeuPXcOyOlOS47egNmxcwiU8IzYJyDLk7hu20= X-Received: by 2002:ac8:5a8f:0:b0:476:9ec4:5006 with SMTP id d75a77b69052e-479775d5e5fmr229011221cf.37.1744700463365; Tue, 15 Apr 2025 00:01:03 -0700 (PDT) MIME-Version: 1.0 References: <87o6yedo5f.fsf@mail.linkov.net> <87v7rc2cw8.fsf@mail.linkov.net> <877c3m4qpg.fsf@mail.linkov.net> In-Reply-To: <877c3m4qpg.fsf@mail.linkov.net> From: Wilhelm Kirschbaum Date: Tue, 15 Apr 2025 09:00:52 +0200 X-Gm-Features: ATxdqUHtGcyYes8ZcdT12eYVww24l6SBGNjwrLuqEjm3K7Zl44FiRW8XFTRDeNs Message-ID: Subject: Re: bug#76788: treesit-thing-settings for elixir-ts-mode To: Juri Linkov , 76788@debbugs.gnu.org Content-Type: multipart/alternative; boundary="0000000000005bc4a60632cbbb1d" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76788 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000005bc4a60632cbbb1d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Apr 14, 2025 at 7:08=E2=80=AFPM Juri Linkov wrote= : > > I just tested the latest changes and the forward-sexp is not working > > correctly. I will look at the changes when I have a minute. > > Previously C-M-f jumped from "def" to "end": > Yes, this is desired. The expression starts with "def" and the do -> end is just an argument to the "def" macro. > > def fun(a) do > end > > The change is to jump only from "do" to "end" like in other ts-modes. > Why is this better? The one huge advantage that elixir-ts-mode brought to the table was to navigate between functions, the existing elixir-mode could not get this right. Before the changes it is possible to navigate or kill the next x functions, now it is unpredictable. The Elixir grammar is a bit more complicated than most other languages unfortunately. > > To keep jumping from "def" to "end" a possible change is to add > > (or (and "\\`call\\'" ,#'elixir-ts--defun-p) > > to the 'list' thing in 'treesit-thing-settings'. > It's not just for the "def" to "end" this change breaks forward-sexp for function calls, case blocks etc... > > But there is a new command 'treesit-cycle-sexp-type' > that switches from jumping "do"->"end" to "def"->"end". > I don't see any scenario where this will be useful to navigate Elixir code. Apologies, I see I replied to you directly and not to the thread. Added the thread again. --0000000000005bc4a60632cbbb1d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Mon, Apr 14, 202= 5 at 7:08=E2=80=AFPM Juri Linkov <jur= i@linkov.net> wrote:
> I just tested the latest changes and the forward-sexp is n= ot working
> correctly. I will look at the changes when I have a minute.

Previously C-M-f jumped from "def" to "end":

Yes, this is desired. The expression starts with = "def" and the do -> end is just an argument to the "def&q= uot; macro.=C2=A0=C2=A0

=C2=A0 def fun(a) do
=C2=A0 end

The change is to jump only from "do" to "end" like in o= ther ts-modes.

Why is this better? The = one huge advantage that elixir-ts-mode brought to the table was to navigate= between functions, the existing elixir-mode could not get this right.=C2= =A0
Before the changes it is possible to navigate or kill the nex= t x functions, now it is unpredictable. The Elixir grammar is a bit more co= mplicated than most other languages unfortunately.=C2=A0
=C2=A0

To keep jumping from "def" to "end" a possible change i= s to add

=C2=A0 (or (and "\\`call\\'" ,#'elixir-ts--defun-p)

to the 'list' thing in 'treesit-thing-settings'.

It's not just for the "def" to &quo= t;end" this change breaks forward-sexp for function calls, case blocks= etc...
=C2=A0

But there is a new command 'treesit-cycle-sexp-type'
that switches from jumping "do"->"end" to "def&= quot;->"end".

I don't = see any scenario where this will be useful to navigate Elixir code.=C2=A0


Apologies, I see I replied to you di= rectly and not to the thread.=C2=A0 Added the thread again.=C2=A0
--0000000000005bc4a60632cbbb1d-- From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 15 13:37:53 2025 Received: (at 76788) by debbugs.gnu.org; 15 Apr 2025 17:37:53 +0000 Received: from localhost ([127.0.0.1]:54946 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u4kEK-0006pH-JW for submit@debbugs.gnu.org; Tue, 15 Apr 2025 13:37:53 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:45469) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u4kEH-0006nQ-Cm for 76788@debbugs.gnu.org; Tue, 15 Apr 2025 13:37:50 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 75A0543290; Tue, 15 Apr 2025 17:37:41 +0000 (UTC) From: Juri Linkov To: Wilhelm Kirschbaum Subject: Re: bug#76788: treesit-thing-settings for elixir-ts-mode In-Reply-To: Organization: LINKOV.NET References: <87o6yedo5f.fsf@mail.linkov.net> <87v7rc2cw8.fsf@mail.linkov.net> <877c3m4qpg.fsf@mail.linkov.net> Date: Tue, 15 Apr 2025 20:30:34 +0300 Message-ID: <87h62pcp2x.fsf@mail.linkov.net> 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: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvvdegudduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepvddprhgtphhtthhopeejieejkeekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepfihkihhrshgthhgsrghumhesghhmrghilhdrtghomh X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 76788 Cc: 76788@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > Previously C-M-f jumped from "def" to "end": > > Yes, this is desired. The expression starts with "def" and the do -> end is > just an argument to the "def" macro. > > def fun(a) do > end > > The change is to jump only from "do" to "end" like in other ts-modes. > > Why is this better? Because otherwise there is no easy way to navigate to the function name and its arguments. There were many complaints that unlike smie-based sexp now tree-sitter jumps too far directly to the end of functions. So sadly an idealistic promise of tree-sitter doesn't fit perfectly into the real world. For many years I used elixir-mode before switching to elixir-ts-mode. And it caused a minor disruption by the inability to move to the function name and arguments as before in elixir-mode. > The one huge advantage that elixir-ts-mode brought to > the table was to navigate between functions, the existing elixir-mode could > not get this right. The new command 'treesit-cycle-sexp-type' keeps this advantage while allowing the users to toggle the traditional behavior where C-M-f moves over the arguments. > Before the changes it is possible to navigate or kill the next x functions, > now it is unpredictable. The Elixir grammar is a bit more complicated than > most other languages unfortunately. This is still possible with 'treesit-cycle-sexp-type'. From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 16 02:46:55 2025 Received: (at 76788) by debbugs.gnu.org; 16 Apr 2025 06:46:55 +0000 Received: from localhost ([127.0.0.1]:33632 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u4wXu-0006do-PT for submit@debbugs.gnu.org; Wed, 16 Apr 2025 02:46:55 -0400 Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]:47404) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1u4wXq-0006dR-Av for 76788@debbugs.gnu.org; Wed, 16 Apr 2025 02:46:52 -0400 Received: by mail-qk1-x729.google.com with SMTP id af79cd13be357-7c597760323so607851785a.3 for <76788@debbugs.gnu.org>; Tue, 15 Apr 2025 23:46:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744786004; x=1745390804; 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=t7WJJPKA+WSrTRFGcwBtajUFXMXS2+H5r1TpNxON240=; b=Fh2wd79s5G/SCQUG5iOVr0FlEwzLNu9UXR2tjm8MSlFwElw/FudJpnZSf3cYrKBkel AsNg9IdeY+J0ot302RHbyjLUxIMpHes+2MkQqzMrOwgCK1ZnX5Z2UprTf7lG6VB8+KH+ RhHQFxsHP5DrLChyi/BkAPF1iXmldLzJS7hD/JbiTFbS2dL2ok2uecAJd4Yn1qPiEyKT oVDQLTwVSnKXv6D5iiXDSvFNSYAiC56PQ47mCQrocPmQMf5ZOuw8i0zhG+cLABpJD2AX d0aN1hXuRaXesWsA/V/Bxva5rUpIrJlSR/OYvQOi9q+sz9pmxvxmclrgUYu4L/uLSA6M M/RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744786004; x=1745390804; 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=t7WJJPKA+WSrTRFGcwBtajUFXMXS2+H5r1TpNxON240=; b=ZyDbOGmg3uRiFAng149G+xLkDi4W9A/pLqjVHoG7Vjy63Xe8XTavnsBAuNeBbAnd9w Sq1oOW4ZjDRJ7bL/0xbLGq2KKivm0NzzN71jzW5RbUEaYUO9Xn9CVhhgLpcvJya5Mz6z bbL9EsrA+XrC2ObKGwecfHD+cNwsUJ/jRiSmaK+BCLq0VgOGOKDnUOm9joazysj4N/vZ YAp+LTytXBYIY3tsrLIRoNzPqA/t20ReOZqK0vZ1Z6xw2AFkxxtdTA4scDgy2NBwHIcK o8THS8T8j02Lws4ldC3dJe2OYJY5NhAf6GJsNJYMHplS4VxSP5WNGSiYAaE0YDPfEYpx KUmg== X-Gm-Message-State: AOJu0YyWf9Ty/wqNU89SrDKOaDogOdYQ+qdcDp6XB9idO6gU53CUkE/u mIPvEnqhsN3/pRdfYiyAr+yb+5YwvzVXCWthtnexOuarOJNmV53ahEh3IObRNDGva0awbT5Uqs8 yxbjE30eyhywjxsLyQj/TVI7jXuQxEPbD X-Gm-Gg: ASbGncvFN9zM6/vzI+KIztgPpnTu7ZqdYLdVwIoeDYr5FuCnCRYxCAFjG9iwNZCo/Zk HRVftTbhMP/9ok3cOZ40kr0merilVzN5cPiSRK6zMAqSQNUSVRIqGdxAFooRkmUVv/iayuffJI+ Oj27xidFlbqrd8IQKLBEoqLpM= X-Google-Smtp-Source: AGHT+IF4ztEPPXo8keWkD8cYfiHoZbO5ONJEV5l2yDuVwQJYQa6V8xpuideB5Y2YSSV5rB5Nq8qrqr8WYfoASHUOn5E= X-Received: by 2002:a05:620a:258e:b0:7c5:53ab:a74f with SMTP id af79cd13be357-7c919061e29mr63811185a.39.1744786004439; Tue, 15 Apr 2025 23:46:44 -0700 (PDT) MIME-Version: 1.0 References: <87o6yedo5f.fsf@mail.linkov.net> <87v7rc2cw8.fsf@mail.linkov.net> <877c3m4qpg.fsf@mail.linkov.net> <87h62pcp2x.fsf@mail.linkov.net> In-Reply-To: <87h62pcp2x.fsf@mail.linkov.net> From: Wilhelm Kirschbaum Date: Wed, 16 Apr 2025 08:46:33 +0200 X-Gm-Features: ATxdqUHg3g8FR4tbGu2x_dbLBw3XZCpSRf_dr6vlEBO_ru4miFKzrtXVmS6IM9o Message-ID: Subject: Re: bug#76788: treesit-thing-settings for elixir-ts-mode To: Juri Linkov Content-Type: multipart/alternative; boundary="00000000000000f9850632dfa665" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76788 Cc: 76788@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --00000000000000f9850632dfa665 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 15, 2025 at 7:37=E2=80=AFPM Juri Linkov wrote= : > > Previously C-M-f jumped from "def" to "end": > > > > Yes, this is desired. The expression starts with "def" and the do -> en= d > is > > just an argument to the "def" macro. > > > > def fun(a) do > > end > > > > The change is to jump only from "do" to "end" like in other ts-mode= s. > > > > Why is this better? > > Because otherwise there is no easy way to navigate to the function name > and its arguments. There were many complaints that unlike smie-based sex= p > now tree-sitter jumps too far directly to the end of functions. > So sadly an idealistic promise of tree-sitter doesn't fit perfectly > into the real world. > In Elixir def foo(bar), do: bar is pretty much the same as (defun foo (bar) bar) So I think the original implementation is more natural to Emacs users, and yes there is one slight downside, but at the cost of a multitude of improvements for navigation. The majority of users I got feedback from prefer how the new forward-sexp works. The smie-based sexp hardly worked in any expected way as well. Look at how ruby-mode works with navigation ( I have not tried ruby-ts-mode ), as it also properly treats def end blocks as sexps. > > For many years I used elixir-mode before switching to elixir-ts-mode. > And it caused a minor disruption by the inability to move to the > function name and arguments as before in elixir-mode. > I understand that, but this is one case where it is slightly inconvenient, for any other block in elixir it is impossible to navigate around now. > > > The one huge advantage that elixir-ts-mode brought to > > the table was to navigate between functions, the existing elixir-mode > could > > not get this right. > > The new command 'treesit-cycle-sexp-type' keeps this advantage > while allowing the users to toggle the traditional behavior > where C-M-f moves over the arguments. > How do I enable this? Is this a new setting? Will it make the navigation work as before? --00000000000000f9850632dfa665 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Tue, Apr 15,= 2025 at 7:37=E2=80=AFPM Juri Linkov <juri@linkov.net> wrote:
>=C2=A0 =C2=A0 =C2=A0Previously C-M-f jumped from "= def" to "end":
>
> Yes, this is desired. The expression starts with "def" and t= he do -> end is
> just an argument to the "def" macro.=C2=A0
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0def fun(a) do
>=C2=A0 =C2=A0 =C2=A0 =C2=A0end
>
>=C2=A0 =C2=A0 =C2=A0The change is to jump only from "do" to &= quot;end" like in other ts-modes.
>
> Why is this better?

Because otherwise there is no easy way to navigate to the function name
and its arguments.=C2=A0 There were many complaints that unlike smie-based = sexp
now tree-sitter jumps too far directly to the end of functions.
So sadly an idealistic promise of tree-sitter doesn't fit perfectly
into the real world.

In Elixir=C2=A0

=C2=A0 =C2=A0def foo(bar), do: bar=C2=A0
<= br>
is pretty much the same as=C2=A0

(de= fun foo (bar) bar)

So I think the original=C2=A0implementation=C2=A0= is more natural to Emacs users, and yes there is one slight downside, but a= t the cost of a multitude of improvements for navigation. The majority of u= sers I got feedback from prefer how the new forward-sexp works. The smie-ba= sed=C2=A0sexp hardly worked in any expected way as well. Look at how ruby-m= ode works with navigation ( I have not tried ruby-ts-mode ), as it also pro= perly treats def end blocks as sexps.
=C2=A0

For many years I used elixir-mode before switching to elixir-ts-mode.
And it caused a minor disruption by the inability to move to the
function name and arguments as before in elixir-mode.
=
I understand that, but this is one case where it is slightly= inconvenient, for any other block in elixir it is impossible to navigate a= round now.=C2=A0
=C2=A0

> The one huge advantage that elixir-ts-mode brought to
> the table was to navigate between functions, the existing elixir-mode = could
> not get this right.

The new command 'treesit-cycle-sexp-type' keeps this advantage
while allowing the users to toggle the traditional behavior
where C-M-f moves over the arguments.

H= ow do I enable this? Is this a new setting? Will it make the navigation wor= k as before?=C2=A0

--00000000000000f9850632dfa665-- From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 16 13:36:26 2025 Received: (at 76788) by debbugs.gnu.org; 16 Apr 2025 17:36:26 +0000 Received: from localhost ([127.0.0.1]:41346 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u56gS-0001kz-02 for submit@debbugs.gnu.org; Wed, 16 Apr 2025 13:36:26 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:45569) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u56gN-0001jD-L8 for 76788@debbugs.gnu.org; Wed, 16 Apr 2025 13:36:21 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 686B043932; Wed, 16 Apr 2025 17:36:10 +0000 (UTC) From: Juri Linkov To: Wilhelm Kirschbaum Subject: Re: bug#76788: treesit-thing-settings for elixir-ts-mode In-Reply-To: Organization: LINKOV.NET References: <87o6yedo5f.fsf@mail.linkov.net> <87v7rc2cw8.fsf@mail.linkov.net> <877c3m4qpg.fsf@mail.linkov.net> <87h62pcp2x.fsf@mail.linkov.net> Date: Wed, 16 Apr 2025 20:33:01 +0300 Message-ID: <87bjswc8qa.fsf@mail.linkov.net> 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: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvvdeileelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepvddprhgtphhtthhopeejieejkeekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepfihkihhrshgthhgsrghumhesghhmrghilhdrtghomh X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 76788 Cc: 76788@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >>>> Previously C-M-f jumped from "def" to "end": >>> >>> Yes, this is desired. The expression starts with "def" and the do -> end is >>> just an argument to the "def" macro. >>> >>> def fun(a) do >>> end >>> >>> The change is to jump only from "do" to "end" like in other ts-modes. >>> >>> Why is this better? >> >> Because otherwise there is no easy way to navigate to the function name >> and its arguments. There were many complaints that unlike smie-based sexp >> now tree-sitter jumps too far directly to the end of functions. >> So sadly an idealistic promise of tree-sitter doesn't fit perfectly >> into the real world. > > In Elixir > > def foo(bar), do: bar > > is pretty much the same as > > (defun foo (bar) bar) > > So I think the original implementation is more natural to Emacs users, and > yes there is one slight downside, but at the cost of a multitude of > improvements for navigation. The majority of users I got feedback from > prefer how the new forward-sexp works. The smie-based sexp hardly worked in > any expected way as well. Emacs users also use many other ts-modes and complained that forward-sexp relies too much on tree-sitter to jump too far. For example, in c-ts-mode forward-sexp jumped to the function end like 'end-of-defun' does: void foo (void *bar) { bar() } > Look at how ruby-mode works with navigation ( I have not tried > ruby-ts-mode ), as it also properly treats def end blocks as sexps. Ruby is different since its function body is not enclosed within delimiters such as "do...end" in Elixir. >>> The one huge advantage that elixir-ts-mode brought to >>> the table was to navigate between functions, the existing elixir-mode could >>> not get this right. >> >> The new command 'treesit-cycle-sexp-type' keeps this advantage >> while allowing the users to toggle the traditional behavior >> where C-M-f moves over the arguments. > > How do I enable this? Is this a new setting? Ok, since you prefer treesit-based navigation by default, now I enabled 'treesit-cycle-sexp-type' by default in 'elixir-ts-mode'. > Will it make the navigation work as before? Yes, now by default the navigation works as before. From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 17 02:03:07 2025 Received: (at 76788) by debbugs.gnu.org; 17 Apr 2025 06:03:07 +0000 Received: from localhost ([127.0.0.1]:45476 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u5IL4-0005W4-Jj for submit@debbugs.gnu.org; Thu, 17 Apr 2025 02:03:06 -0400 Received: from mail-qt1-x82a.google.com ([2607:f8b0:4864:20::82a]:50212) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1u5IL1-0005VI-TZ for 76788@debbugs.gnu.org; Thu, 17 Apr 2025 02:03:04 -0400 Received: by mail-qt1-x82a.google.com with SMTP id d75a77b69052e-47691d82bfbso8390831cf.0 for <76788@debbugs.gnu.org>; Wed, 16 Apr 2025 23:03:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744869778; x=1745474578; 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=rJ8tx+3lDW0h+3zPQq9MEvfnSlaE0ZmsCzElwmlavgY=; b=YhviCEZGMKDx7KQJi3IEhbkoCDYOf+efTkG5KoJ+fHrpetrSf5K+OzbWfjOiPtvCuv LhgKZX8UNnqaT8MjdONf/HuIC0SIoo9iIp/wtd0HG+HYlpjgZB6MhGM2dsStYDM6yrmP Ge806GLAlnTLoM7lEYB+sBjmsCANVYi9Tl4A/EnefPjTXtV/6nZ7NR+9gT2fWIUNNBBa htyms5p7Sbqw9bR9GNroZZTqUM66Mv48pLX9tVcpkocf3IyH4wslFwbPCk/mJZV8y2fc HnpOsrJ1VIgl67S0t3hSRo85masTmOsRcOPlVHlNh6wsVRtUAaw6jXmI9qE6+foduPV9 v5GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744869778; x=1745474578; 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=rJ8tx+3lDW0h+3zPQq9MEvfnSlaE0ZmsCzElwmlavgY=; b=N6hQhJrAZIlH6pJ5jsLnftH3K8K+MqmMNCUlCmruFdBl0WlZxIakb1W10ABLFCVqco Y/sQ6x/wDHmV095tHc9s8u+NehFw/efjESgDwkqHOuOTajVLJZ2MBVF5IsG6u3KaUBfe QL5l9YahdiWdbTY8qsrbCyd9lsBuzTWxU6sAJu+gjR6WCkE2PevtbLiOrTtvzKGtQ0QY fSEWYGDnCeXa+zENVQ1nbEWBrf3mhP6g5a5vobf6XKsMfyP+DcTxGvG2zXpIsotw9LLJ pmE+yeWvhYs3ekZ6mqhglMDNJudTnb9MDPevHtKoNZ+GPHzpvaA9xfFIcbIXrextHJ57 VAVA== X-Gm-Message-State: AOJu0YzMeN7CDcFQ0nNIzzWOnfoSegCe7tAKhqByxCBTR5n3P0O0UcPJ /Z8fxM3EL2qFSOWyfdG9fWVewuBhWiAAspvB+AKzqJ6jiE4qwpAthbVF3wvRB8kz5iGZKsrWY6B KWQ3hKzey6Beo0z0PF+8cxe0EezVTflzc X-Gm-Gg: ASbGnctylMDZnVAhoQAlpmm9sW4ICjWToSFsht/w9ZAe7YfLWdYyyUNudyEVynV+CJW 3jAOBqIN9khSus5GqARavoRzdBtILvCsfAoBspePx7qIob7UsP5aztN6VjPT/MJ6rHcgjZM2Iv5 lVtyvblBNovoSwaXpIvarYjN3K7VxxM3S9ezrODKL8d8uu0hitbGWwmC0VZWona/rp X-Google-Smtp-Source: AGHT+IGyYBQkUR+De6iQ3dYzighJPTF7d+Eu99QmOG7u5Z+GkT6qO2cMqLv0bjpoGO26dmSbljNBjTfCzoCv98L4qxc= X-Received: by 2002:a05:622a:1802:b0:477:e07:4c5d with SMTP id d75a77b69052e-47ad80b5a76mr74898571cf.19.1744869777981; Wed, 16 Apr 2025 23:02:57 -0700 (PDT) MIME-Version: 1.0 References: <87o6yedo5f.fsf@mail.linkov.net> <87v7rc2cw8.fsf@mail.linkov.net> <877c3m4qpg.fsf@mail.linkov.net> <87h62pcp2x.fsf@mail.linkov.net> <87bjswc8qa.fsf@mail.linkov.net> In-Reply-To: <87bjswc8qa.fsf@mail.linkov.net> From: Wilhelm Kirschbaum Date: Thu, 17 Apr 2025 08:02:47 +0200 X-Gm-Features: ATxdqUF-zSRhUHsniWI4cDyrMxYmNeLHj8pXtTKJVS0HqQkTswK22Nv1Hu3cOwc Message-ID: Subject: Re: bug#76788: treesit-thing-settings for elixir-ts-mode To: Juri Linkov Content-Type: multipart/alternative; boundary="0000000000004bc8ba0632f32707" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76788 Cc: 76788@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000004bc8ba0632f32707 Content-Type: text/plain; charset="UTF-8" > > > Look at how ruby-mode works with navigation ( I have not tried > > ruby-ts-mode ), as it also properly treats def end blocks as sexps. > > Ruby is different since its function body is not enclosed > within delimiters such as "do...end" in Elixir. > Sure, but that is just syntax. the do, end blocks are still just parameters to the def macro. > > >>> The one huge advantage that elixir-ts-mode brought to > >>> the table was to navigate between functions, the existing elixir-mode > could > >>> not get this right. > >> > >> The new command 'treesit-cycle-sexp-type' keeps this advantage > >> while allowing the users to toggle the traditional behavior > >> where C-M-f moves over the arguments. > > > > How do I enable this? Is this a new setting? > > Ok, since you prefer treesit-based navigation by default, now I enabled > 'treesit-cycle-sexp-type' by default in 'elixir-ts-mode'. I already added the hooks to cycle this on my side, but since it is a change, perhaps having the default to function as it is before is not a bad idea. > > > Will it make the navigation work as before? > > Yes, now by default the navigation works as before. > I tried it out and it seems to work well. Thanks for the change, anything to make it simpler is great. --0000000000004bc8ba0632f32707 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

> Look at how ruby-mode works with navigation ( I have not tried
> ruby-ts-mode ), as it also properly treats def end blocks as sexps.
Ruby is different since its function body is not enclosed
within delimiters such as "do...end" in Elixir.
<= div>
Sure, but that is just syntax. the do, end blocks are st= ill just parameters to the def macro.=C2=A0
=C2=A0

>>> The one huge advantage that elixir-ts-mode brought to
>>> the table was to navigate between functions, the existing elix= ir-mode could
>>> not get this right.
>>
>> The new command 'treesit-cycle-sexp-type' keeps this advan= tage
>> while allowing the users to toggle the traditional behavior
>> where C-M-f moves over the arguments.
>
> How do I enable this? Is this a new setting?

Ok, since you prefer treesit-based navigation by default, now I enabled
'treesit-cycle-sexp-type' by default in 'elixir-ts-mode'.

I already added the hooks to cycle this on m= y side, but since it is a change, perhaps having the default to function as= it is before is not a bad idea.
=C2=A0

> Will it make the navigation work as before?

Yes, now by default the navigation works as before.
I tried it out and it seems to work well. Thanks for the chang= e, anything to make it simpler is great.=C2=A0
--0000000000004bc8ba0632f32707-- From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 17 06:15:27 2025 Received: (at 76788) by debbugs.gnu.org; 17 Apr 2025 10:15:27 +0000 Received: from localhost ([127.0.0.1]:45885 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u5MHG-00079F-Hx for submit@debbugs.gnu.org; Thu, 17 Apr 2025 06:15:26 -0400 Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]:59662) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1u5MHD-00077t-Dm for 76788@debbugs.gnu.org; Thu, 17 Apr 2025 06:15:24 -0400 Received: by mail-qt1-x835.google.com with SMTP id d75a77b69052e-476f4e9cf92so3866081cf.3 for <76788@debbugs.gnu.org>; Thu, 17 Apr 2025 03:15:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744884917; x=1745489717; 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=Pmv5tSby7Ur72Nc8fCitJHg1YNLGtOLNgLQY2ewJOoE=; b=f3KFaBquix6AaN5Jshpcnrv6SFTitVeCjjDPXwVZnRyrpo4Wbvcsf6oWGcjjgc4WDY ZmVOjforBQDZJBrHaxghKVZvmL6PBYtKwuXrZmq7CxCRWAXFnYiD1Ms8r5rqxx2Bcelh QtHyzBEWxwZoc8lXJv3TpFIargU7BPe6mnlKuFoqn3X1cy4Ey6Ek0n60YaQllf7l8Q/K RJhJgHqYfJLwEbXTAdJ9pR3rLV4Lo7o6SFqo1Wp5i0k3ghIYy9NPehpsWtf3e4r6soL4 E1WoJ4duDvfZom8AKagXIrRD0flFF/T5JgsfwOXUlYU0mEoDwlUdxwyTXnLrEBJb7nD0 d8IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744884917; x=1745489717; 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=Pmv5tSby7Ur72Nc8fCitJHg1YNLGtOLNgLQY2ewJOoE=; b=BMfdq4chwQFDop0eqYhSuozokHKOsOHPhYSqPJ+PPSzgPLPbVw4KMHg8ClDUldu/kP IHEAuGmj5dUYbLYYNSZlWmlo1HvicE+yRuUOd9LBWrvkNsYwzrxGnQ0MhBzHSTBeOvhn M188Zj+kUbeFOKbU7/3bg9Bjo9M0uLLTUPPYCfn4sk26XGyb1K6Nkad0iqRyXmHNdqdd ua3DNb+rOGUMvbZ5E2qmiGBXkxs9rXkcHN8sQK3bN7hFhV09FoOFrVg5Mt9MObTqYuOb vKtRMLV4lv74XNLhdUCMllXkpFF5mTULniHVGLvh3Ed+npdxrAXEEZ78k7i1NHHOfqSc nfkg== X-Gm-Message-State: AOJu0Ywxq3d78J7Yi+7EdQr3jvKQZW12KMd/NvEU2TDK+vGMcq+b8VgB pKMhDPmslMBbySUe3kXiUFcgO9ejsNlBtK7zmOuosnSzBOvSPX1aX8y7cOPBAh4NzCaQLo/Dh4P YCytlfzETcwyf8jA8TCZwGEyr2Nyvhqj2aUE= X-Gm-Gg: ASbGncsJk7xTdTA1IwYuEBOUZuJH9PR1+wz1eQgzWcN55JULYtN/mF5l9glUNXxrBp6 4+GE+Rv/dMHyHx4XFScnCNVFoKb2ilSrZ0OhzsUvBeyfPKag9UxgCCBSz/ndUANMhuRgONuJjEB ELDTZfRaXojUD/pznPPba+ZI4= X-Google-Smtp-Source: AGHT+IFeQUvj0s4Wl0+vlRcbD95I1//f23qJiMF9vmODSEFnY4rpB+7t+ZC7/FeOrdeefsk2yTqQch0ICGzif0CgH+o= X-Received: by 2002:a05:622a:348:b0:476:9e28:ce47 with SMTP id d75a77b69052e-47ad8166fa5mr69817411cf.45.1744884917437; Thu, 17 Apr 2025 03:15:17 -0700 (PDT) MIME-Version: 1.0 References: <87o6yedo5f.fsf@mail.linkov.net> <87v7rc2cw8.fsf@mail.linkov.net> <877c3m4qpg.fsf@mail.linkov.net> <87h62pcp2x.fsf@mail.linkov.net> <87bjswc8qa.fsf@mail.linkov.net> In-Reply-To: From: Wilhelm Kirschbaum Date: Thu, 17 Apr 2025 12:15:06 +0200 X-Gm-Features: ATxdqUH_BGmMw8vCF0-bLbzuj5DJ9XyPy3lzTSXkebrsAYEMmfxoEzO4bFGCqoU Message-ID: Subject: Re: bug#76788: treesit-thing-settings for elixir-ts-mode To: Juri Linkov Content-Type: multipart/alternative; boundary="000000000000ad8b200632f6adba" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76788 Cc: 76788@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000ad8b200632f6adba Content-Type: text/plain; charset="UTF-8" There is an error trying to indent code using tab with the latest changes: treesit--indent-largest-node-at: Wrong type argument: listp, # car(#) treesit--indent-largest-node-at(3629) treesit--indent-1() treesit-indent() indent--funcall-widened(treesit-indent) indent-for-tab-command(nil) funcall-interactively(indent-for-tab-command nil) call-interactively(indent-for-tab-command nil nil) command-execute(indent-for-tab-command) --000000000000ad8b200632f6adba Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

There is an error trying to ind= ent code using tab with the latest changes:=C2=A0

treesit--indent-la= rgest-node-at: Wrong type argument: listp, #<treesit-parser for elixir&g= t;

=C2=A0 car(#<treesit-parser for elixir>)
=C2=A0 treesit-= -indent-largest-node-at(3629)
=C2=A0 treesit--indent-1()
=C2=A0 trees= it-indent()
=C2=A0 indent--funcall-widened(treesit-indent)
=C2=A0 ind= ent-for-tab-command(nil)
=C2=A0 funcall-interactively(indent-for-tab-com= mand nil)
=C2=A0 call-interactively(indent-for-tab-command nil nil)
= =C2=A0 command-execute(indent-for-tab-command)


--000000000000ad8b200632f6adba-- From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 17 13:22:22 2025 Received: (at 76788) by debbugs.gnu.org; 17 Apr 2025 17:22:22 +0000 Received: from localhost ([127.0.0.1]:48275 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u5SwQ-0000NW-Ga for submit@debbugs.gnu.org; Thu, 17 Apr 2025 13:22:22 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:58567) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u5SwO-0000N0-Eg for 76788@debbugs.gnu.org; Thu, 17 Apr 2025 13:22:21 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id E0BF143A2E; Thu, 17 Apr 2025 17:22:10 +0000 (UTC) From: Juri Linkov To: Wilhelm Kirschbaum Subject: Re: bug#76788: treesit-thing-settings for elixir-ts-mode In-Reply-To: Organization: LINKOV.NET References: <87o6yedo5f.fsf@mail.linkov.net> <87v7rc2cw8.fsf@mail.linkov.net> <877c3m4qpg.fsf@mail.linkov.net> <87h62pcp2x.fsf@mail.linkov.net> <87bjswc8qa.fsf@mail.linkov.net> Date: Thu, 17 Apr 2025 20:21:31 +0300 Message-ID: <87plhahffo.fsf@mail.linkov.net> 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: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvvdelkeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepvddprhgtphhtthhopeejieejkeekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepfihkihhrshgthhgsrghumhesghhmrghilhdrtghomh X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 76788 Cc: 76788@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > There is an error trying to indent code using tab with the latest changes: > > treesit--indent-largest-node-at: Wrong type argument: listp, > # > > car(#) > treesit--indent-largest-node-at(3629) > treesit--indent-1() > treesit-indent() > indent--funcall-widened(treesit-indent) > indent-for-tab-command(nil) > funcall-interactively(indent-for-tab-command nil) > call-interactively(indent-for-tab-command nil nil) > command-execute(indent-for-tab-command) Thanks, now fixed. From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 18 12:55:17 2025 Received: (at 76788) by debbugs.gnu.org; 18 Apr 2025 16:55:17 +0000 Received: from localhost ([127.0.0.1]:52696 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u5ozj-0007F3-L4 for submit@debbugs.gnu.org; Fri, 18 Apr 2025 12:55:17 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:58057) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u5ozf-00079L-FJ for 76788@debbugs.gnu.org; Fri, 18 Apr 2025 12:55:14 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 2537A439EF; Fri, 18 Apr 2025 16:55:01 +0000 (UTC) From: Juri Linkov To: Wilhelm Kirschbaum Subject: Re: bug#76788: treesit-thing-settings for elixir-ts-mode In-Reply-To: Organization: LINKOV.NET References: <87o6yedo5f.fsf@mail.linkov.net> <87v7rc2cw8.fsf@mail.linkov.net> Date: Fri, 18 Apr 2025 19:52:54 +0300 Message-ID: <87cyd9if89.fsf@mail.linkov.net> 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: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvfedvieekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepvddprhgtphhtthhopeifkhhirhhstghhsggruhhmsehgmhgrihhlrdgtohhmpdhrtghpthhtohepjeeijeekkeesuggvsggsuhhgshdrghhnuhdrohhrgh X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 76788 Cc: 76788@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >> 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. > > Thanks for this. I kind of forgot about it, sorry about that. It would be > great if that is possible, but I don't know how that would work though? Ok, now I added elixir embedding in heex, as well as elixir->heex->elixir that e.g. highlights '@entries' in: def unordered_list(assigns) do ~H"""
  • {render_slot(@inner_block, entry)}
""" end that works well. From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 20 13:42:12 2025 Received: (at 76788) by debbugs.gnu.org; 20 Apr 2025 17:42:13 +0000 Received: from localhost ([127.0.0.1]:52589 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u6YgE-00083L-UE for submit@debbugs.gnu.org; Sun, 20 Apr 2025 13:42:12 -0400 Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]:48515) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u6Yg9-00080q-9k for 76788@debbugs.gnu.org; Sun, 20 Apr 2025 13:42:07 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 19DE841C3E; Sun, 20 Apr 2025 17:41:52 +0000 (UTC) From: Juri Linkov To: Wilhelm Kirschbaum Subject: Re: bug#76788: treesit-thing-settings for elixir-ts-mode In-Reply-To: <87cyd9if89.fsf@mail.linkov.net> Organization: LINKOV.NET References: <87o6yedo5f.fsf@mail.linkov.net> <87v7rc2cw8.fsf@mail.linkov.net> <87cyd9if89.fsf@mail.linkov.net> Date: Sun, 20 Apr 2025 20:40:39 +0300 Message-ID: <87tt6i91ew.fsf@mail.linkov.net> 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: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvfeekheegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepvddprhgtphhtthhopeejieejkeekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepfihkihhrshgthhgsrghumhesghhmrghilhdrtghomh X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 76788 Cc: 76788@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >>> 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. >> >> Thanks for this. I kind of forgot about it, sorry about that. It would be >> great if that is possible, but I don't know how that would work though? > > Ok, now I added elixir embedding in heex, as well as > elixir->heex->elixir Thanks for elixir/heex indentation tests that revealed one problem, I fixed it by adapting one query from heex-ts--indent-rules to elixir-ts--indent-rules: ((parent-is "^source$") ,(lambda (_node _parent bol &rest _) ;; If Elixir is embedded indent to parent ;; otherwise indent to the bol. (if (treesit-local-parsers-at (point)) (save-excursion (goto-char (treesit-node-start (treesit-node-at bol 'heex))) (back-to-indentation) (point)) (pos-bol))) ,(lambda (_node _parent _bol &rest _) (if (treesit-local-parsers-at (point)) elixir-ts-indent-offset 0))) So now all indentation tests are passed. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 22 02:40:26 2025 Received: (at 76788) by debbugs.gnu.org; 22 Apr 2025 06:40:26 +0000 Received: from localhost ([127.0.0.1]:43862 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u77Iw-0001pD-1H for submit@debbugs.gnu.org; Tue, 22 Apr 2025 02:40:26 -0400 Received: from mail-qt1-x836.google.com ([2607:f8b0:4864:20::836]:44460) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1u77Is-0001p0-U6 for 76788@debbugs.gnu.org; Tue, 22 Apr 2025 02:40:23 -0400 Received: by mail-qt1-x836.google.com with SMTP id d75a77b69052e-476b89782c3so56549121cf.1 for <76788@debbugs.gnu.org>; Mon, 21 Apr 2025 23:40:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745304017; x=1745908817; 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=EaDHxrEdQ4pZ6p4TLBHm1FQkKap13NLJ1zcR9+Uw5JU=; b=hvl71iY7ApTCgqSq+Y16wKq+xK9NZ2/LKpKW2dqV9zKfPdNVyTj2Gc2xrs/TbqaT3j Ab32kxSv1d/rc18aEu3DIF8xmr6yo6AqdNs2P/bGmOorQOzlV68LMFVsAljwPVVPr4GX x7omGnUwob/vTtYyD/RU2Nna49XYdhEcVgeezl3a2YOjdNlwM0h/aCnbR2/QJBZsBep4 hzxTBRVGbT5jAJbq49e87GVr2yoSb+OP3AGFixCZLqBIEXhsXXOpZtRzudKCK7YKkc5Y 7RneQD8ZvpRaQEiZx5PmDSEQBxDUNz/0gVjlPOQXJzbsQV/oBM8akIhuquGX3WOmYPd/ 3/zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745304017; x=1745908817; 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=EaDHxrEdQ4pZ6p4TLBHm1FQkKap13NLJ1zcR9+Uw5JU=; b=K80Y8Ogyr/CONNsSM+8xjP1A2W7pKk8gCAKsvMJdMjLlf+s+/g86s2zuGm5HkTbX2A OQLn6Xc0BEzK0H4qiDIwJFkaUqSgvkp9gIb7gYStGYKSdpOW1N6Jmx5Qfq2NBs5T6Ldl ntSIqVudkl85N68lRdLmsmJBVIKzsYmP/DYlnS1fvwC/c6aTp1s8SK7NX8mzVcqaTOXd a/YWqJ4syATPY5QulZvr+6mDsNHHAGy/gmHZiBNA/QXhaAOO38FktfofLQS38yMYWDh8 rg0UNy/4MBlBJ7n3rMPbIdW9kiJ6oFYu3fpKuMFrMCBphx3y2bn0Hj+PJm6s9FeJKi6S 4nHA== X-Gm-Message-State: AOJu0YzXFm/efzE0j+Ixxjs2wNI4BSVqL2qW5j6ivXBGlTHoVmaV1uTM Cb5nBrX71C/AlOzAC23cAWtsWmmzRJyTj4G06zXJKimCBnaPtpObPtW+UUrMWMAi0N2wNeYcZfQ EIwU+Km0mEHyEJ4TeziyTDF/LDNQ= X-Gm-Gg: ASbGncuE+cLDaD3FqOD8F27dSGcVVZUjey3hr04jOhd1DkpCZp/J6RmSHIuhGeTcv8v 7Eu/3W8qzdRg6tSbpSZUjiwAcrdCumL6Z2QlQ0scuV0zJUBGhoUBf5Pi+TH3SR5xCe+8Tru0BlX YEfx+CrAOJHcR//KmZfM6vbYg= X-Google-Smtp-Source: AGHT+IHmXGC5R4pD5kEaBgJYoKWyzRkK+++wxebUbPfVGafTwm4c7jd1oQXIDBiixqjI2heWJsn4xHFQb/odn2FVXZc= X-Received: by 2002:ac8:5947:0:b0:477:c04:b511 with SMTP id d75a77b69052e-47aec3cbf5cmr234404541cf.31.1745304017155; Mon, 21 Apr 2025 23:40:17 -0700 (PDT) MIME-Version: 1.0 References: <87o6yedo5f.fsf@mail.linkov.net> <87v7rc2cw8.fsf@mail.linkov.net> <87cyd9if89.fsf@mail.linkov.net> In-Reply-To: <87cyd9if89.fsf@mail.linkov.net> From: Wilhelm Kirschbaum Date: Tue, 22 Apr 2025 08:40:05 +0200 X-Gm-Features: ATxdqUGqUgjUXrIhjFjkN4cR-lamFCduaNAHN7WeabxWN2wbrqPWJKY76RvqujQ Message-ID: Subject: Re: bug#76788: treesit-thing-settings for elixir-ts-mode To: Juri Linkov Content-Type: multipart/alternative; boundary="000000000000f7bd0a0633584123" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76788 Cc: 76788@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000f7bd0a0633584123 Content-Type: text/plain; charset="UTF-8" > > Ok, now I added elixir embedding in heex, as well as > elixir->heex->elixir that e.g. highlights '@entries' in: > > def unordered_list(assigns) do > ~H""" >
    >
  • {render_slot(@inner_block, entry)}
  • >
> """ > end > > that works well. > Fantastic, this seems to work well on my side as well. --000000000000f7bd0a0633584123 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Ok, now I added elixir embedding i= n heex, as well as
elixir->heex->elixir that e.g. highlights '@entries' in:

=C2=A0 def unordered_list(assigns) do
=C2=A0 =C2=A0 ~H"""
=C2=A0 =C2=A0 <ul>
=C2=A0 =C2=A0 =C2=A0 <li :for=3D{entry <- @entries}>{render_slot(@= inner_block, entry)}</li>
=C2=A0 =C2=A0 </ul>
=C2=A0 =C2=A0 """
=C2=A0 end

that works well.

Fantastic, this seems = to work well on my side as well.=C2=A0=C2=A0
--000000000000f7bd0a0633584123-- From unknown Thu Aug 14 21:55:39 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 20 May 2025 11:24:23 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator