Juri Linkov <juri@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 76788) by debbugs.gnu.org; 10 Apr 2025 16:37:38 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 10 12:37:37 2025 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> 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: 76788 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.
bug-gnu-emacs@HIDDEN
:bug#76788
; Package emacs
.
Full text available.Stefan Kangas <stefankangas@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 76788) by debbugs.gnu.org; 10 Mar 2025 06:40:06 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 10 02:40:06 2025 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> Subject: Re: bug#76788: treesit-thing-settings for elixir-ts-mode To: Juri Linkov <juri@HIDDEN> Content-Type: multipart/alternative; boundary="0000000000009badb5062ff73d84" X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 76788 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: -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 <<a href=3D"mailto:juri@lin= kov.net" target=3D"_blank">juri@HIDDEN</a>> 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'm adding the new 'list' thing to all ts-modes<br> and noticed that elixir-ts-mode defines the function<br> 'elixir-ts--forward-sexp'.<br> <br> This function can be superseded by the 'list' definition<br> in treesit-thing-settings that supports such commands<br> as 'forward-sexp', 'forward-list', 'up-list', '= down-list',<br> and modes 'show-paren-mode', 'hs-minor-mode'.<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 "\\`call\\'" ,#'elixir-ts--defun-p)<br> <br> When enabled, it causes too much trouble<br> with e.g. 'show-paren-mode', etc.<br> OTOH, this definition is not much needed since<br> 'C-M-a' (beginning-of-defun) and 'C-M-e' (end-of-defun)<br> already cover this need instead of using 'C-M-f/b',<br> so 'C-M-a/e' could be used to navigate between functions.<br> And 'C-M-f/b' navigate in all other cases such as<br> between 'do' and 'end', parens, etc.<br> </blockquote></div> --0000000000009badb5062ff73d84--
bug-gnu-emacs@HIDDEN
:bug#76788
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 6 Mar 2025 18:17:10 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 06 13:17:10 2025 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> To: bug-gnu-emacs@HIDDEN Subject: treesit-thing-settings for elixir-ts-mode Organization: LINKOV.NET X-Debbugs-Cc: Wilhelm Kirschbaum <wkirschbaum@HIDDEN> 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-Debbugs-Envelope-To: submit 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 --=-=-=--
Juri Linkov <juri@HIDDEN>
:wkirschbaum@HIDDEN, bug-gnu-emacs@HIDDEN
.
Full text available.wkirschbaum@HIDDEN, bug-gnu-emacs@HIDDEN
:bug#76788
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.