From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Fu Yuan Newsgroups: gmane.emacs.bugs Subject: bug#66845: 29.1; cmake-ts-mode indentation broken Date: Sun, 5 Nov 2023 10:16:02 -0800 Message-ID: References: Mime-Version: 1.0 (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="35948"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Randy Taylor , 66845@debbugs.gnu.org To: Juan Palacios Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 05 19:17:14 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 1qzhgQ-00097t-CF for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Nov 2023 19:17:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qzhff-0002Ic-Sn; Sun, 05 Nov 2023 13:16:27 -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 1qzhfd-0002GU-Ma for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2023 13:16:25 -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 1qzhfd-0007Eg-Bn for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2023 13:16:25 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qzhgE-0002gr-6w for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2023 13:17:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Fu Yuan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Nov 2023 18:17: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.169920821810324 (code B ref 66845); Sun, 05 Nov 2023 18:17:02 +0000 Original-Received: (at 66845) by debbugs.gnu.org; 5 Nov 2023 18:16:58 +0000 Original-Received: from localhost ([127.0.0.1]:38149 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qzhgA-0002gQ-BV for submit@debbugs.gnu.org; Sun, 05 Nov 2023 13:16:58 -0500 Original-Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:43141) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qzhg8-0002gA-3a for 66845@debbugs.gnu.org; Sun, 05 Nov 2023 13:16:56 -0500 Original-Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-5b9390d6bd3so3772814a12.0 for <66845@debbugs.gnu.org>; Sun, 05 Nov 2023 10:16:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699208173; x=1699812973; darn=debbugs.gnu.org; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=/hQPBFBDBTjsFS02ddZv3o/9T9nGWhkVrTZ/a25d2eM=; b=i9VsCdAhsP/gFBsharbZz93R/iuxY2vZPvlVmFrhsw5HkNE4L80t9I9Zo6OhQ3V6tB bNvCdstMHy9xZvzD3+bhKpw/UQB+1bTX7hYPKqz0QLed+kPwgiYMRv8F+KvtyDAmLddN T/n0ZQWlKdF3cfOdpQTkGi+w+rZ1j0ltUW8fNDrvQcELrCDpUUNqRXm99sflq1LDfy1S lr+tiilCjYE1upQzHbiv5sL/Q6c/VxuGGTrgmeH1bCXmUZsDwa9P+qi+Ns11sRsEH81t KYRGOdRfPKzvBEk/r1+J4igO7NY3rhEEepWUjLVpmYF8eNIc8pr56WjxdUleqQ6ZAod/ LJtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699208173; x=1699812973; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/hQPBFBDBTjsFS02ddZv3o/9T9nGWhkVrTZ/a25d2eM=; b=pEXrIwXNJpWFBsUwGgKgShOGncw0VUGkdnVvnqLoziaoPBfMxqO1baBqloEKQ+CoBA M7IJQepWfNP799Hc79AeDKJhE2rfE0sdClh/xcRRhuvyDJxs2Z2D//XmU4p6l+hJS9Z6 /1hVp7DOy6D5Kj1mVmm0ZccmIuzhxoebNLFDHhdUiWQDH0brNjmrrnytss6De/+KGfXf bTrmFjrK7i7hbfZIZ2d79AavOM/Ta9gfu6Ad1qQV62UreAM9lxqD63mZladQM2fgaYXB 3j/k7FQfe08BBc145KggcKUtQKmytRmxq5aRFlOCKpHrH+dZVtKfc5OnEocffIvUuqKH dZig== X-Gm-Message-State: AOJu0YwtMAOGyttcbYdoluafbNDdK4DxoG9+2TXXUFlyz1qA3xvL4cIC RcdLI+8YQaP+DcXNq60ZEIc= X-Google-Smtp-Source: AGHT+IHQ3K42LKaq7AI5GULStqqcEMyUJiBkC9S7FP4cRrkQqbL7z9UtP1s+2vBbgz1avOHyNZhGwA== X-Received: by 2002:a17:90b:1845:b0:280:963d:9cb with SMTP id mf5-20020a17090b184500b00280963d09cbmr10936235pjb.23.1699208173079; Sun, 05 Nov 2023 10:16:13 -0800 (PST) Original-Received: from smtpclient.apple (128-092-225-098.biz.spectrum.com. [128.92.225.98]) by smtp.gmail.com with ESMTPSA id 13-20020a17090a004d00b0027782f611d1sm4728679pjb.36.2023.11.05.10.16.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 05 Nov 2023 10:16:12 -0800 (PST) In-Reply-To: X-Mailer: iPhone Mail (21A360) 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:273839 Archived-At: > =E5=9C=A8 2023=E5=B9=B411=E6=9C=885=E6=97=A5=EF=BC=8C=E4=B8=8A=E5=8D=886:3= 3=EF=BC=8CJuan Palacios =E5=86=99=E9=81=93=EF=BC=9A= >=20 > =EF=BB=BFEl mi=C3=A9, 1 nov 2023 a las 3:45, Randy Taylor () e= scribi=C3=B3: >>=20 >>> On Tuesday, October 31st, 2023 at 07:35, Juan Palacios wrote: >>> Using cmake grammar from https://github.com/uyha/tree-sitter-cmake >>>=20 >>> 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. >>>=20 >>> 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))) >>>=20 >>> 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) ( ))) >>>=20 >>=20 >> 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. >=20 Hey Randy, I just see this, sorry :-) I=E2=80=99ll have a look tonight or tomorrow. Yuan=