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.bugs Subject: bug#64442: 29.0.92; treesit-beginning-of-defun fails in DEFUN functions in C Date: Tue, 15 Aug 2023 00:30:53 -0700 Message-ID: <5B9E9ADF-C632-475B-8D68-3BF0275279E5@gmail.com> References: <83a5wcncj8.fsf@gnu.org> <83pm57lxbo.fsf@gnu.org> <835y6wgr77.fsf@gnu.org> <93E5B9EA-D349-4316-B314-D6994329C261@gmail.com> <83r0oplvro.fsf@gnu.org> <83y1iji7b7.fsf@gnu.org> <2134730B-05A4-4032-84B6-42FD3CDC48AE@gmail.com> <83a5uwe27a.fsf@gnu.org> <5EA1F5AD-C6C4-4838-8265-5A7ECF69041D@gmail.com> <83jztxbzsp.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_2738A620-DE9F-450E-B804-7F8911A20874" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18702"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 64442@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 15 09:32:27 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 1qVoXT-0004gl-5G for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 15 Aug 2023 09:32:27 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qVoX7-0005pf-3W; Tue, 15 Aug 2023 03:32:05 -0400 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 1qVoX4-0005pV-LJ for bug-gnu-emacs@gnu.org; Tue, 15 Aug 2023 03:32:03 -0400 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 1qVoX4-0003KF-Cu for bug-gnu-emacs@gnu.org; Tue, 15 Aug 2023 03:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qVoX4-0002cQ-7h for bug-gnu-emacs@gnu.org; Tue, 15 Aug 2023 03:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 15 Aug 2023 07:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64442 X-GNU-PR-Package: emacs Original-Received: via spool by 64442-submit@debbugs.gnu.org id=B64442.16920846759998 (code B ref 64442); Tue, 15 Aug 2023 07:32:02 +0000 Original-Received: (at 64442) by debbugs.gnu.org; 15 Aug 2023 07:31:15 +0000 Original-Received: from localhost ([127.0.0.1]:34936 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVoWJ-0002bC-2Q for submit@debbugs.gnu.org; Tue, 15 Aug 2023 03:31:15 -0400 Original-Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:51624) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVoWF-0002av-IB for 64442@debbugs.gnu.org; Tue, 15 Aug 2023 03:31:14 -0400 Original-Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1bcad794ad4so32392745ad.3 for <64442@debbugs.gnu.org>; Tue, 15 Aug 2023 00:31:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692084666; x=1692689466; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=33b6+lvvffBCy7mQMHGWbY7xcJ/JYPPnFYAIbyelvwQ=; b=GgNfUcvgJUCGKKMBEC5+wLTyhqhqF23AEbVWXZHMpwnstch4umnf9uCByaWzXid5uU 0O3j4THEGPl5lguvY1DnGXNeQ432NPURfhZq9aMdwnw09guaRxmsso0P8OaVncJALJBx Ljmrd1ALKl6+Odbp0AXzo7APQsmhblPQxr0dR6BagKyUD40Lt+5v7J4zJMkJJGg2S0E7 UX4ErRNkM6YJhG+6pEVlzXBFlnVOh+rpz7n9IU42SSRaJOTXBWjjMiGUbZgWxCgMpqET 0XnNl325vGs2LpYqvJl0x/N80FHaPYJaRRLPrBfECFl/QTBSG/dh56ldpNFxf6jqsLMN Dv7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692084666; x=1692689466; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=33b6+lvvffBCy7mQMHGWbY7xcJ/JYPPnFYAIbyelvwQ=; b=SFpMOVgESgkqXCvABEiIzm4Kn1HxrTNCLy+hXMVXT9qCHELgLaQlSO1en09clq7ZjL bv2DNG+YsAwR92yuWFylzN0kpF2jGXNtk11snwe3HpLIXxr3B6FzWZGQZZoPYnDNI0/F vlyH6mIhOxrBGWh+iXge0f4PljQly66w+CUvwCPEp3tjgPSUhOgQCG88DqtR96KtU/tn 21F7nfwfPI9HLRRUk+mQeMRZOhd2KDEjD5uNer5vzK0yn4m7tBin/KdT+KhDLFbus+b8 MAfPscHYpfAaM/uJ8wzCE0ABaacDQNHTft7JV2rRm+ydVXC0kUZm7YARYThUAK8vve9/ TA4Q== X-Gm-Message-State: AOJu0Yz0BFOEmZESZPH50nsazEtvblcDT9WoCsWMseUBUEYUEkHruz4U vK+mIvfCFGBuFJBNM8zhgEU= X-Google-Smtp-Source: AGHT+IHdYrdUqrYjJidhbKytMXW5QbdgCIaBA8UFfdZr0gVxX4hGEAzjXLeFfOoamQpUH8DLmcT6MQ== X-Received: by 2002:a17:902:b907:b0:1bc:5182:1dd6 with SMTP id bf7-20020a170902b90700b001bc51821dd6mr8078296plb.35.1692084665623; Tue, 15 Aug 2023 00:31:05 -0700 (PDT) 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 x12-20020a170902ec8c00b001b1a2c14a4asm10479481plg.38.2023.08.15.00.31.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Aug 2023 00:31:04 -0700 (PDT) In-Reply-To: <83jztxbzsp.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.600.7) 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:267469 Archived-At: --Apple-Mail=_2738A620-DE9F-450E-B804-7F8911A20874 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Aug 14, 2023, at 4:59 AM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Sun, 13 Aug 2023 22:20:56 -0700 >> Cc: 64442@debbugs.gnu.org >>=20 >>> I like this much better than what we have now, thanks. But I have a >>> question: can we perhaps recognize the "function" of the body as = such, >>> and then automatically move to the previous defun, which is the = right >>> place? The "defun" that is the body has no name, so maybe that = could >>> be used as a sign? =20 >>=20 >> We can easily tell the body from the declaration, but we can=E2=80=99t = easily tell whether we should automatically move forward or backward. = When point arrives at the point between the declaration and the body, = should it move to the beginning of the next defun or the beginning of = the declaration? This, plus it=E2=80=99s not straightforward to know = whether we are in between a body and a declaration. I really don=E2=80=99t= want to add even more cursed hacks into c-ts-mode.el :-) >=20 > Too bad, but okay. >=20 >>> That would allow "C-x 4 a" to work inside a DEFUN, >>> something that still works less reliably with this patch: you must = be >>> in the "first defun" to get it to find the name of the function. >>=20 >> C-x 4 a should=E2=80=99ve been fixed already. And it shouldn=E2=80=99t = rely on this fix to work. Do you have a recipe for when it doesn=E2=80=99t= work? >=20 > Just try it with your patch. If point is inside the body, the > function's name is not captured by "C-x 4 a=E2=80=9D. My bad, I must=E2=80=99ve been trying C-x 4 a in a different Emacs = session, which worked. Anyway, I updated the patch and C-x 4 a should = now work. Yuan --Apple-Mail=_2738A620-DE9F-450E-B804-7F8911A20874 Content-Disposition: attachment; filename=defun.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="defun.patch" Content-Transfer-Encoding: quoted-printable =46rom=20779092b28e472d17adfff92c1b9d7403aad7a106=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Yuan=20Fu=20=0ADate:=20Thu,=20= 10=20Aug=202023=2014:27:29=20-0700=0ASubject:=20[PATCH]=20Support=20= defun=20navigation=20for=20DEFUN=20in=20c-ts-mode=20(bug#64442)=0A=0A= Before=20this=20change,=20beginning/end-of-defun=20just=20ignores=20= DEFUN=20in=0Ac-ts-mode.=20After=20this=20change,=20= beginning/end-of-defun=20can=20recognize=0ADEFUN,=20but=20a=20DEFUN=20= definition=20is=20considered=20two=20defuns.=20Eg,=0A= beginning/end-of-defun=20will=20stop=20at=20(1)=20(2)=20and=20(3)=20in=20= the=20following=0Asnippet:=0A=0A(1)DEFUN=20("treesit-node-parser",=0A=20=20= =20=20=20=20=20Ftreesit_node_parser,=20Streesit_node_parser,=0A=20=20=20=20= =20=20=201,=201,=200,=0A=20=20=20=20=20=20=20doc:=20/*=20Return=20the=20= parser=20to=20which=20NODE=20belongs.=20=20*/)=0A=20=20(Lisp_Object=20= node)=0A(2){=0A=20=20CHECK_TS_NODE=20(node);=0A=20=20return=20XTS_NODE=20= (node)->parser;=0A}=0A(3)=0A=0AIdeally=20we=20want=20point=20to=20only=20= stop=20at=20(1)=20and=20(3),=20but=20that'll=20be=20a=0Alot=20harder=20= to=20do.=0A=0A*=20lisp/progmodes/c-ts-mode.el:=0A= (c-ts-mode--defun-valid-p):=20Refactor=20to=20take=20in=20account=20of=20= DEFUN=20body.=0A(c-ts-mode--emacs-defun-body-p):=20New=20function.=0A= (c-ts-base-mode):=20Add=20DEFUN=20and=20DEFUN=20body=20to=20recognized=20= types.=0A(c-ts-mode--emacs-defun-at-point):=20Now=20that=20we=20= recognize=20both=20parts=20of=0Aa=20DEFUN=20as=20defun,=20= c-ts-mode--emacs-defun-at-point=20needs=20to=20be=20updated=0Ato=20adapt=20= to=20it.=0A---=0A=20lisp/progmodes/c-ts-mode.el=20|=20115=20= +++++++++++++++++++-----------------=0A=201=20file=20changed,=2060=20= insertions(+),=2055=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/progmodes/c-ts-mode.el=20b/lisp/progmodes/c-ts-mode.el=0Aindex=20= 98797bf3ce7..34a89b4dcad=20100644=0A---=20a/lisp/progmodes/c-ts-mode.el=0A= +++=20b/lisp/progmodes/c-ts-mode.el=0A@@=20-880,29=20+880,36=20@@=20= c-ts-mode--defun-name=0A=20(defun=20c-ts-mode--defun-valid-p=20(node)=0A=20= =20=20"Return=20non-nil=20if=20NODE=20is=20a=20valid=20defun=20node.=0A=20= Ie,=20NODE=20is=20not=20nested."=0A-=20=20(or=20= (c-ts-mode--emacs-defun-p=20node)=0A-=20=20=20=20=20=20(not=20(or=20(and=20= (member=20(treesit-node-type=20node)=0A-=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20'("struct_specifier"=0A= -=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20"enum_specifier"=0A-=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20"union_specifier"=0A= -=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20"declaration"))=0A-=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20;;=20If=20NODE's=20type=20is=20one=20of=20the=20= above,=20make=20sure=20it=20is=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20;;=20top-level.=0A-=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(treesit-node-top-level=0A-=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20node=20(rx=20(or=20= "function_definition"=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20"type_definition"=0A= -=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20"struct_specifier"=0A-=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20"enum_specifier"=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20"union_specifier"=0A= -=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20"declaration"))))=0A-=0A-=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(and=20(equal=20(treesit-node-type=20node)=20= "declaration")=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20;;=20If=20NODE=20is=20a=20declaration,=20make=20sure=20it=20is=20not=20= a=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20= function=20declaration.=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(equal=20(treesit-node-type=0A-=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (treesit-node-child-by-field-name=0A-=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20node=20"declarator"))=0A= -=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20"function_declarator"))))))=0A+=20=20(let=20((top-level-p=20= (lambda=20(node)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(not=20(treesit-node-top-level=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20node=20= (rx=20(or=20"function_definition"=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20"type_definition"=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20"struct_specifier"=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20"enum_specifier"=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20"union_specifier"=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20"declaration")))))))=0A+=20=20=20=20(pcase=20(treesit-node-type=20= node)=0A+=20=20=20=20=20=20;;=20The=20declaration=20part=20of=20a=20= DEFUN.=0A+=20=20=20=20=20=20("expression_statement"=20= (c-ts-mode--emacs-defun-p=20node))=0A+=20=20=20=20=20=20;;=20The=20body=20= of=20a=20DEFUN.=0A+=20=20=20=20=20=20("compound_statement"=20= (c-ts-mode--emacs-defun-body-p=20node))=0A+=20=20=20=20=20=20;;=20If=20= NODE's=20type=20is=20one=20of=20these=20three,=20make=20sure=20it=20is=0A= +=20=20=20=20=20=20;;=20top-level.=0A+=20=20=20=20=20=20((or=20= "struct_specifier"=0A+=20=20=20=20=20=20=20=20=20=20=20"enum_specifier"=0A= +=20=20=20=20=20=20=20=20=20=20=20"union_specifier")=0A+=20=20=20=20=20=20= =20(funcall=20top-level-p=20node))=0A+=20=20=20=20=20=20;;=20If=20NODE=20= is=20a=20declaration,=20make=20sure=20it's=20not=20a=20function=0A+=20=20= =20=20=20=20;;=20declaration=20(we=20only=20want=20function_definition)=20= and=20is=20a=0A+=20=20=20=20=20=20;;=20top-level=20declaration.=0A+=20=20= =20=20=20=20("declaration"=0A+=20=20=20=20=20=20=20(and=20(not=20(equal=20= (treesit-node-type=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(treesit-node-child-by-field-name=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20node=20= "declarator"))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20"function_declarator"))=0A+=20=20=20=20=20=20=20=20=20=20=20= =20(funcall=20top-level-p=20node)))=0A+=20=20=20=20=20=20;;=20Other=20= types=20don't=20need=20further=20verification.=0A+=20=20=20=20=20=20(_=20= t))))=0A=20=0A=20(defun=20c-ts-mode--defun-for-class-in-imenu-p=20(node)=0A= =20=20=20"Check=20if=20NODE=20is=20a=20valid=20entry=20for=20the=20Class=20= subindex.=0A@@=20-955,6=20+962,11=20@@=20c-ts-mode--emacs-defun-p=0A=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20t)=0A=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20"DEFUN")))=0A=20=0A+(defun=20= c-ts-mode--emacs-defun-body-p=20(node)=0A+=20=20"Return=20non-nil=20if=20= NODE=20is=20the=20function=20body=20of=20a=20DEFUN."=0A+=20=20(and=20= (equal=20(treesit-node-type=20node)=20"compound_statement")=0A+=20=20=20=20= =20=20=20(c-ts-mode--emacs-defun-p=20(treesit-node-prev-sibling=20= node))))=0A+=0A=20(defun=20c-ts-mode--emacs-defun-at-point=20(&optional=20= range)=0A=20=20=20"Return=20the=20defun=20node=20at=20point.=0A=20=0A@@=20= -969,31=20+981,18=20@@=20c-ts-mode--emacs-defun-at-point=0A=20If=20RANGE=20= is=20non-nil,=20return=20(BEG=20.=20END)=20where=20BEG=20end=20END=0A=20= encloses=20the=20whole=20defun.=20=20This=20is=20for=20when=20the=20= entire=20defun=0A=20is=20required,=20not=20just=20the=20declaration=20= part=20for=20DEFUN."=0A-=20=20(or=20(when-let=20((node=20= (treesit-defun-at-point)))=0A-=20=20=20=20=20=20=20=20(if=20range=0A-=20=20= =20=20=20=20=20=20=20=20=20=20(cons=20(treesit-node-start=20node)=0A-=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(treesit-node-end=20node))=0A-=20= =20=20=20=20=20=20=20=20=20=20=20node))=0A-=20=20=20=20=20=20(and=20= c-ts-mode-emacs-sources-support=0A-=20=20=20=20=20=20=20=20=20=20=20(let=20= ((candidate-1=20;=20For=20when=20point=20is=20in=20the=20DEFUN=20= statement.=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (treesit-node-prev-sibling=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(treesit-node-top-level=0A-=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(treesit-node-at=20(point))=0A-=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20"compound_statement")))=0A-=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(candidate-2=20;=20For=20= when=20point=20is=20in=20the=20body.=0A-=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(treesit-node-top-level=0A-=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(treesit-node-at=20(point))=0A-=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20"expression_statement")))=0A= -=20=20=20=20=20=20=20=20=20=20=20=20=20(when-let=0A-=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20((node=20(or=20(and=20= (c-ts-mode--emacs-defun-p=20candidate-1)=0A-=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= candidate-1)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(and=20(c-ts-mode--emacs-defun-p=20= candidate-2)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20candidate-2))))=0A-=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(if=20range=0A-=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(cons=20(treesit-node-start=20node)=0A-=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (treesit-node-end=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(treesit-node-next-sibling=20node)))=0A-=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20node))))))=0A+=20=20(when-let*=20= ((node=20(treesit-defun-at-point))=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(defun-range=20(cons=20(treesit-node-start=20node)=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(treesit-node-end=20node))))=0A+=20=20=20=20;;=20Make=20some=20= adjustment=20for=20DEFUN.=0A+=20=20=20=20(when=20= c-ts-mode-emacs-sources-support=0A+=20=20=20=20=20=20(cond=20= ((c-ts-mode--emacs-defun-body-p=20node)=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20(setq=20node=20(treesit-node-prev-sibling=20node))=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20(setcar=20defun-range=20(treesit-node-start=20= node)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20= ((c-ts-mode--emacs-defun-p=20node)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20(setcdr=20defun-range=20(treesit-node-end=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (treesit-node-next-sibling=20node))))))=0A+=20=20=20=20(if=20range=20= defun-range=20node)))=0A=20=0A=20(defun=20c-ts-mode-indent-defun=20()=0A=20= =20=20"Indent=20the=20current=20top-level=20declaration=20syntactically.=0A= @@=20-1111,13=20+1110,19=20@@=20c-ts-base-mode=0A=20=0A=20=20=20;;=20= Navigation.=0A=20=20=20(setq-local=20treesit-defun-type-regexp=0A-=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(cons=20(regexp-opt=20= '("function_definition"=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20"type_definition"=0A= -=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20"struct_specifier"=0A-=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20"enum_specifier"=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20"union_specifier"=0A= -=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20"class_specifier"=0A-=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20"namespace_definition"))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (cons=20(regexp-opt=20(append=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= '("function_definition"=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "type_definition"=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20"struct_specifier"=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20"enum_specifier"=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20"union_specifier"=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "class_specifier"=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "namespace_definition")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(and=20= c-ts-mode-emacs-sources-support=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= '(;;=20DEFUN.=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "expression_statement"=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= ;;=20DEFUN=20body.=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "compound_statement"))))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20#'c-ts-mode--defun-valid-p))=0A=20=20=20(setq-local=20= treesit-defun-skipper=20#'c-ts-mode--defun-skipper)=0A=20=20=20= (setq-local=20treesit-defun-name-function=20#'c-ts-mode--defun-name)=0A= --=20=0A2.41.0=0A=0A= --Apple-Mail=_2738A620-DE9F-450E-B804-7F8911A20874 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_2738A620-DE9F-450E-B804-7F8911A20874--