From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juan Palacios Newsgroups: gmane.emacs.bugs Subject: bug#66845: 29.1; cmake-ts-mode indentation broken Date: Sun, 5 Nov 2023 15:32:40 +0100 Message-ID: References: <4m1KSu7eJ_B7nNCVOnvZM_edTrQhMTtxiKFwUB4zNoYufrWuTYcq_tL1iIRml2xqDRdTDavJBnE7B4iNmswVLwzGXI96E_FNcXkCeDqUzVo=@rjt.dev> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18080"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 66845@debbugs.gnu.org To: Randy Taylor Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 05 15:33:38 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qzeC1-0004TT-O5 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Nov 2023 15:33:37 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qzeBq-0004Hd-JI; Sun, 05 Nov 2023 09:33:26 -0500 Original-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 1qzeBq-0004HV-1p for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2023 09:33:26 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qzeBp-0001aK-PF for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2023 09:33:25 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qzeCQ-00027i-8N for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2023 09:34:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juan Palacios Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Nov 2023 14:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66845 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 66845-submit@debbugs.gnu.org id=B66845.16991948058114 (code B ref 66845); Sun, 05 Nov 2023 14:34:02 +0000 Original-Received: (at 66845) by debbugs.gnu.org; 5 Nov 2023 14:33:25 +0000 Original-Received: from localhost ([127.0.0.1]:36386 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qzeBo-00026m-Fb for submit@debbugs.gnu.org; Sun, 05 Nov 2023 09:33:24 -0500 Original-Received: from mail-yw1-x1135.google.com ([2607:f8b0:4864:20::1135]:46307) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qzeBm-00026Z-Li for 66845@debbugs.gnu.org; Sun, 05 Nov 2023 09:33:23 -0500 Original-Received: by mail-yw1-x1135.google.com with SMTP id 00721157ae682-5a7afd45199so43849787b3.0 for <66845@debbugs.gnu.org>; Sun, 05 Nov 2023 06:32:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699194759; x=1699799559; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=OYlqSzPMfqdFqxapyBJTIfzC0E0QlhAioUWIEhkreDY=; b=YixAS9r9qFX7GfNaU4K5v7GSzOKFsPFpJheMHf0CHBT1yti7IDWocemnEJraxuOBrH D3yOM+k0Za2oN6VSzCESD1GbV/AoWBhaYMHTGAEMTur7bHrtayKU/JKjgz/+JoA//Hd2 g63z6n0Ljtt6WhH3uDNkf11zKmVuXlX0k0y+fuxttoYRhrRCCw8FI6LA0j4yfiZDIoGA pIUbbytHnbhWjg3nKSMoDIeNt2pBVL+vP0DA7p7fVDgbOc46TZvAgmgj3z35ce4z8rXO EAspmGY6T13mStveabiuwu21ymhbsV/EuW/LtE392tgB7WTlcZdvtrkgXgxJS38PLxbC fiww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699194759; x=1699799559; h=content-transfer-encoding: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=OYlqSzPMfqdFqxapyBJTIfzC0E0QlhAioUWIEhkreDY=; b=Q68QDhPW8aZNK5q6MTP9+wxcnngMUcTjh/rrz8h9aLTXE6FgsR1z7BHgzHvYZPk3D7 7ybtNvhRzi51Gv7+zBTFNwDgEdvoj3t70Q2Td2URq6XXSvcBe4BxUJikku6bn21qagAW VeOcu1sCl3pQFDI/klXC5X+mfNGgCHspgmfOyY4rOQ6j6U9j+Vz7iX6IpZlnmxMgdcvk 0YuZgBQ1zbq4V8cRw8dwbEPssWYE+AN/2eBeI36QMYsq6G821dm9D9QoUJ/vuxU5uCx6 KzGDgVl63L/nsjUonKqwszty/66Ksob3krKP3YLGi5drR5FTniSpDCVF2XMvVhm73sdb ZuVg== X-Gm-Message-State: AOJu0YxUhCpnNDocraqqMJefaltLiqGefPs2zg4Mu627TbaLXW3+5w54 XWIVv/YkrNJPD6dB2dfUNQnT5UHgHPdNoh5zIQ== X-Google-Smtp-Source: AGHT+IHn6LsR6CuM2v/vRvCry3RyV0BuIdVovphSdH+qnvZ2CShrG5dYQVtX5BJID81FSrG+wB1uRKB+9ZKx8J6GoRE= X-Received: by 2002:a81:9b85:0:b0:5a7:bc79:9618 with SMTP id s127-20020a819b85000000b005a7bc799618mr6953944ywg.12.1699194759428; Sun, 05 Nov 2023 06:32:39 -0800 (PST) In-Reply-To: <4m1KSu7eJ_B7nNCVOnvZM_edTrQhMTtxiKFwUB4zNoYufrWuTYcq_tL1iIRml2xqDRdTDavJBnE7B4iNmswVLwzGXI96E_FNcXkCeDqUzVo=@rjt.dev> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:273828 Archived-At: El mi=C3=A9, 1 nov 2023 a las 3:45, Randy Taylor () escribi=C3= =B3: > > On Tuesday, October 31st, 2023 at 07:35, Juan Palacios wrote: > > Using cmake grammar from https://github.com/uyha/tree-sitter-cmake > > > > Reproduction: > > 1. emacs -q > > 2. C-x C-f test.cmake > > 3. M-x cmake-ts-mode > > 4. Insert the following text: > > if(TRUE) > > message("indent") > > endif() > > 5. Move the point to the beginning of the second line. > > 6. TAB > > 7. Notice that no indentation is performed. > > > > treesit-simple-indent-rules local value: > > ((cmake > > ((node-is ")") > > parent-bol 0) > > ((node-is "else_command") > > parent-bol 0) > > ((node-is "elseif_command") > > parent-bol 0) > > ((node-is "endforeach_command") > > parent-bol 0) > > ((node-is "endfunction_command") > > parent-bol 0) > > ((node-is "endif_command") > > parent-bol 0) > > ((parent-is "foreach_loop") > > parent-bol cmake-ts-mode-indent-offset) > > ((parent-is "function_def") > > parent-bol cmake-ts-mode-indent-offset) > > ((parent-is "if_condition") > > parent-bol cmake-ts-mode-indent-offset) > > ((parent-is "normal_command") > > parent-bol cmake-ts-mode-indent-offset))) > > > > treesit-explore-mode shows: > > (if_condition > > (if_command (if) ( > > (argument_list > > (argument (unquoted_argument))) > > )) > > (body > > (normal_command (identifier) ( > > (argument_list > > (argument > > (quoted_argument " (quoted_element) "))) > > ))) > > (endif_command (endif) ( ))) > > > > I've attached a patch fixing this while retaining compatibility with > older grammars. 2 new versions of the grammar, v0.3.0 and v0.4.0 > (and anything beyond for now) wrap things in new nodes. I applied the patch to 29.1, and I can confirm that it's working fine. Thanks.