From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Tree sitter support for C-like languages Date: Fri, 11 Nov 2022 21:43:21 -0800 Message-ID: References: <87tu36em9t.fsf@thornhill.no> <45FD2F78-F15B-488B-9348-A8E298D8AD35@gmail.com> <87v8nmyqqp.fsf@thornhill.no> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) 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="22742"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Theodor Thornhill Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 12 06:43:55 2022 Return-path: Envelope-to: ged-emacs-devel@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 1otjJ5-0005hn-19 for ged-emacs-devel@m.gmane-mx.org; Sat, 12 Nov 2022 06:43:55 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otjIj-0002wH-SM; Sat, 12 Nov 2022 00:43:33 -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 1otjIf-0002rj-4K for emacs-devel@gnu.org; Sat, 12 Nov 2022 00:43:30 -0500 Original-Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1otjId-00049D-Gp for emacs-devel@gnu.org; Sat, 12 Nov 2022 00:43:28 -0500 Original-Received: by mail-pf1-x42c.google.com with SMTP id v28so6551513pfi.12 for ; Fri, 11 Nov 2022 21:43:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=IVbwYPXxhSUR4aNkFCCFvWIBCrRcGWOJyJ+M9yKkPyA=; b=kKOaNa22rxyDJaiwZbOwk7vptQgKDgPgmJnsIUinO573F8xlbszY2w+gykncQBbrp/ +s6EHsU3/8z027bf/y1bKMmFpk8QS+e4yWk7cBXS5/4VqLE+sQRwcxalHejRYZGusuDy /i+RghBKNwnoKdpo7FMpCa/dr5DVhBn1Cqckxpvzszk5+afwHO3V745M4MEDKxDOLaHv DoIdrMMbbKHz+gYjUYdfkQ4vJ4Nxepm8I/Gdwz5lPpoTsVPYQ3UkVkJjgT6pkwiYLOp7 EEA5aijzzycTArHxyoUPMYmWuP4YW8MchNuaejS/apkHCcoKgkFhKFhjnPdw0H9v7Ofp UIWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IVbwYPXxhSUR4aNkFCCFvWIBCrRcGWOJyJ+M9yKkPyA=; b=xFWgddbkO2IFVJZFFYlKjWcMIcuIChO1SFy2CuuJ82GTgSmwChZEouFabvVDwBq9N/ bi9eZD/ALtFuoW9wwbr/dk/hL1T2eq4526FisZmlpiUHNU2UnDnjdbsBVYAjApaIGkaQ 9IbW/pPQBzVp5lDuxQMe/L8CnbT1YP6Y1+hkrr3OPJzEJ7O2GHtEYRxpf6/wULV0CaIf 1v8RYAGeM69NZEBiskZ9Ve/GHfeMnfSuvJBxK+Tl5BOolq+LzGwtKYziW+tCYTlgV1ni PyHhN02Y5rxpQLo/SoFajRIOQobxan+hLN9do2zZLUJu5C+oOEUR3YCPbwgZM4Z7UEpP IMPQ== X-Gm-Message-State: ANoB5pl+8rzZLAX8g4c+tK6bNmo0FSh3Pnxb2EBIuH3OiSg5H7s5xF0L 80C3jaymIrhFAGevO4hHTCUIZs26BMk= X-Google-Smtp-Source: AA0mqf47RLYx4SDwFMbCcHkr5LTCdTeDfF8IFPgbBpqDUs9oQTr3i52XqJ2MSTnl/NSDZ3OuWrgoaQ== X-Received: by 2002:aa7:970d:0:b0:56b:823d:e3b5 with SMTP id a13-20020aa7970d000000b0056b823de3b5mr5647067pfg.81.1668231805463; Fri, 11 Nov 2022 21:43:25 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id d4-20020a623604000000b0056b88187374sm2472969pfa.85.2022.11.11.21.43.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Nov 2022 21:43:25 -0800 (PST) In-Reply-To: <87v8nmyqqp.fsf@thornhill.no> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=casouri@gmail.com; helo=mail-pf1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:299605 Archived-At: > On Nov 10, 2022, at 10:01 PM, Theodor Thornhill = wrote: >=20 > Yuan Fu writes: >=20 >>> On Nov 10, 2022, at 9:45 AM, Theodor Thornhill = wrote: >>>=20 >>>=20 >>>=20 >>> Hi all, >>>=20 >>> See the attached patch for support for several C-like languages. >>>=20 >>> They all support: >>> - Font locking >>> - Indentation (with styles for c/c++) >>> - Movement >>> - Imenu >>> - Which-func >>>=20 >>> These modes are meant as a supplement to tree-sitter. >>>=20 >>> I'm hopeful for some constructive criticism, and some testing. This >>> patch needs to be applied to the feature/tree-sitter branch, and = should >>> hopefully be applied there before we merge the branch to master, = well >>> before Emacs 29 is cut. >>>=20 >>> I hope you like it, >>>=20 >>> Theo >>=20 >> This is fantastic! I=E2=80=99m trying them out right now :-) >>=20 >> Some things I noticed: >>=20 >> The indentation for the closing bracket of a struct is off: >>=20 >> struct regexp_cache >> { >> struct regexp_cache *next; >> }; >>=20 >=20 > Yeah. >=20 >> Imenu has some duplicate entries, the patch below should fix that. >>=20 >> I also added the new contextual thingy to font-lock settings. >=20 > Thanks, added! >=20 > See below patch. The struct issue was an ordering problem when I > extracted the styles. Should be good now >=20 > Theo >=20 > <0001-Add-Tree-Sitter-modes-for-C-like-languages.patch> I noticed that with the default indent style, Emacs indents like this: int main () { for (int j =3D 0; j < 5; j++) a[j] =3D 3; int i =3D 1; swap(i, a[i+1]); Point p =3D {0, 1}; } int main () { for (int j =3D 0; j < 5; j++) a[j] =3D 3; int i =3D 1; swap(i, a[i+1]); Point p =3D {0, 1}; } Is this expected? Yuan=