GNU bug report logs - #62825
29.0.90; c-ts-mode doesn't recognize DEFUN functions

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Eli Zaretskii <eliz@HIDDEN>; dated Fri, 14 Apr 2023 06:45:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 62825 <at> debbugs.gnu.org:


Received: (at 62825) by debbugs.gnu.org; 16 Apr 2023 08:14:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 16 04:14:33 2023
Received: from localhost ([127.0.0.1]:50572 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pnxWr-0002EX-GV
	for submit <at> debbugs.gnu.org; Sun, 16 Apr 2023 04:14:33 -0400
Received: from eggs.gnu.org ([209.51.188.92]:55350)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pnxWp-0002EJ-Mo
 for 62825 <at> debbugs.gnu.org; Sun, 16 Apr 2023 04:14:32 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pnxWi-0001rD-Sc; Sun, 16 Apr 2023 04:14:24 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=FdvCjDUzCOaGFtTWKbM0OQEe4rMW9vOv/Dy/uSeyl8s=; b=FovoAl4n6z4zvo/lROmD
 EvrbAfAunpBuMDH1INExvIABglqylWZdAUfrbiScGFOp8/zurvN7K5sqqdYR1SGYyVP6C4rz9cOBQ
 s+dvzcgewCtLCzDRz/YpkfxLsVzAp+xRjxS+0f7Yl1j3PP79xQYGus5ifE0ZybdLW5ThnkofPgmkw
 G7E7C5NQmnfx426ii73eM92SepcPPYAX+vyUXdmcnRBrq/fcrYf/ZTANKcYQxHZUUDmjcoSRqNmxm
 2+oOwLT6zMn3p6gc3Qo0U4MhrL9TS7BEaOn1kaf0va8emlw+4VN5TVe6VJyhB3g1K8gCODNnXbOo2
 BCYIzZWz+j8j2Q==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pnxWg-0001PI-PY; Sun, 16 Apr 2023 04:14:24 -0400
Date: Sun, 16 Apr 2023 11:14:25 +0300
Message-Id: <83jzycb5we.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <80353D80-21FD-4ADE-8982-4B67C59B7E7B@HIDDEN> (message from
 Yuan Fu on Sat, 15 Apr 2023 22:37:02 -0700)
Subject: Re: bug#62825: 29.0.90; c-ts-mode doesn't recognize DEFUN functions
References: <80353D80-21FD-4ADE-8982-4B67C59B7E7B@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62825
Cc: theo@HIDDEN, 62825 <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: -3.3 (---)

> From: Yuan Fu <casouri@HIDDEN>
> Date: Sat, 15 Apr 2023 22:37:02 -0700
> Cc: 62825 <at> debbugs.gnu.org,
>  theo@HIDDEN
> 
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > Thanks.  But I wonder why do we need the c-ts-mode-emacs-devel knob.
> > Why not recognize DEFUN by default everywhere?  CC Mode does that,
> > AFAIK, so why shouldn't c-ts-mode do the same?
> 
> I just thought the fix is a bit hacky, and does add some overhead, so
> people who don’t need it might not be happy to know that they can’t turn
> it off.

OK, but I made it into a defcustom and turned this on by default.  I
also renamed a few symbols, please take a look.

Btw, should the code you added to c-ts-mode--defun-name recognize
DEFUN nodes only when this variable is non-nil?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62825; Package emacs. Full text available.

Message received at 62825 <at> debbugs.gnu.org:


Received: (at 62825) by debbugs.gnu.org; 16 Apr 2023 05:37:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 16 01:37:23 2023
Received: from localhost ([127.0.0.1]:50470 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pnv4k-0003Vl-JS
	for submit <at> debbugs.gnu.org; Sun, 16 Apr 2023 01:37:22 -0400
Received: from mail-pj1-f54.google.com ([209.85.216.54]:42568)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1pnv4i-0003VX-9Q
 for 62825 <at> debbugs.gnu.org; Sun, 16 Apr 2023 01:37:20 -0400
Received: by mail-pj1-f54.google.com with SMTP id
 fw22-20020a17090b129600b00247255b2f40so8889708pjb.1
 for <62825 <at> debbugs.gnu.org>; Sat, 15 Apr 2023 22:37:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1681623434; x=1684215434;
 h=to:cc:date:message-id:subject:mime-version
 :content-transfer-encoding:from:from:to:cc:subject:date:message-id
 :reply-to; bh=HcNM5N6RUiQAkWK0cY8MfL0xUSwBw7TAecS5AL6ypWs=;
 b=Roq7rfJMISo7pH1m584hh8I7b+OM2u1Gtsu51D+6fM+W3viiKmWXIObnPHnkZ2wvKy
 MJ1dCE5dPFYu3hepbSBaGOCgj4phlvNfV44MEwirxncaZPy6hDNFOtpWaKmqTSXcFgSS
 b7TZI59HQHGnK/dFSB9HmJxoRYFrqnUVGaqtfcLDWaX3ZTzVp9432ZyV6hcAKePyx7K4
 WJ+HQfbVspB8YhrYqY/TB5gLFqB6CaYQqoDVxEuZ/XMu6ftu8FaCjyz0ltIlZhKGIO/y
 mkByj4oDg0JrP2sq0QBCBEVWwa3HSGMTlKTMyOqa6TWbP31u40kTRIM551gnCVQh7bN4
 CxNA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1681623434; x=1684215434;
 h=to:cc:date:message-id:subject:mime-version
 :content-transfer-encoding:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=HcNM5N6RUiQAkWK0cY8MfL0xUSwBw7TAecS5AL6ypWs=;
 b=lpBwlgap9T3Y0y15fZQauugWCxG3cF/PmW1LC4aEDitwOev+rP5Rm24RSb6EReLtID
 cXonWB6+fYqeCaX2o7gpLId+Pn21ZGk+MnKgPDLUtOqKbECeFSCewddNqcG9n+8iHTwN
 zIVz88ipzTULWw2e7ebVzvQILL+f8T7dgGZ4soOV5oodiVof+PW+5r6I1T+sos0H+pn5
 VoTU75lOeFdabHnGScCzCpH908Hq1YF1wAjEyS0xbOG+e1iCJ35XLs2C4MjJGHuws3P0
 TgWEdd3r4RnL20JeEZiBoXUcNBwny/u4WQd41Tln9FZJ8QkqRwYBfGH+15KErjOlPiPR
 ukOQ==
X-Gm-Message-State: AAQBX9cQJfykv6YCoKK198n3f4xOQ94ISfsTSLRrQsp+dAY4FCfNTllv
 7qPw6ka5FLO4t5kjIKDtNrU=
X-Google-Smtp-Source: AKy350b86JHz69JueKNO4oVYjEQF8ZSA2ZuHmyfp283HWbn2JhjjXui5WjtetSTjhwLz/x4bF6oK1Q==
X-Received: by 2002:a17:902:e747:b0:1a6:6090:7114 with SMTP id
 p7-20020a170902e74700b001a660907114mr9858829plf.69.1681623434542; 
 Sat, 15 Apr 2023 22:37:14 -0700 (PDT)
Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com.
 [172.117.161.177]) by smtp.gmail.com with ESMTPSA id
 6-20020a170902c20600b001a6d08dc847sm244505pll.173.2023.04.15.22.37.13
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 15 Apr 2023 22:37:14 -0700 (PDT)
From: Yuan Fu <casouri@HIDDEN>
Content-Type: text/plain;
	charset=utf-8
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.500.231\))
Subject: Re: bug#62825: 29.0.90; c-ts-mode doesn't recognize DEFUN functions
Message-Id: <80353D80-21FD-4ADE-8982-4B67C59B7E7B@HIDDEN>
Date: Sat, 15 Apr 2023 22:37:02 -0700
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3731.500.231)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62825
Cc: theo@HIDDEN, 62825 <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.0 (-)


Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Yuan Fu <casouri@HIDDEN>
>> Date: Fri, 14 Apr 2023 13:19:41 -0700
>> Cc: Theodor Thornhill <theo@HIDDEN>,
>>  62825 <at> debbugs.gnu.org
>>=20
>> Ok, I fixed indent-defund and add-log. Because a DEFUN is made of
>> two nodes in the parse tree rather than one, it=E2=80=99s a bit hard =
to
>> incorporate it into the normal treesit-defun-at-point, etc,
>> functions. And we probably have to fix DEFUN case-by-case.
>
> Thanks.  But I wonder why do we need the c-ts-mode-emacs-devel knob.
> Why not recognize DEFUN by default everywhere?  CC Mode does that,
> AFAIK, so why shouldn't c-ts-mode do the same?

I just thought the fix is a bit hacky, and does add some overhead, so
people who don=E2=80=99t need it might not be happy to know that they =
can=E2=80=99t turn
it off.

Yuan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62825; Package emacs. Full text available.

Message received at 62825 <at> debbugs.gnu.org:


Received: (at 62825) by debbugs.gnu.org; 15 Apr 2023 07:49:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 15 03:49:06 2023
Received: from localhost ([127.0.0.1]:48165 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pnaef-0001Lw-La
	for submit <at> debbugs.gnu.org; Sat, 15 Apr 2023 03:49:05 -0400
Received: from eggs.gnu.org ([209.51.188.92]:58958)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pnaed-0001LS-Fx
 for 62825 <at> debbugs.gnu.org; Sat, 15 Apr 2023 03:49:04 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pnaeX-0003KI-Bo; Sat, 15 Apr 2023 03:48:57 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=bYo7ZuM5kcO3dKZzMRGoaXsbJXYe1ToOcOs3TLrTQ1Y=; b=H41lhiqBiiDBI2a/mLpW
 w7gZdaA1GIBw/1ib/qkeQo8dDnNl6qyWI46A115RK6LMk0hH0nMsMFqsPULPWsAUiCwL930cTBkew
 JscBAbkxo2G5x3RwBsHjGyHlRGHQ+SHZAQWnI0LBcByxGBLwY16be9O4+tzrIF5epsQEOm+tPE0YR
 vPlT8iP4QFQy/sB/zMonZS9nv+Pg0PL0Tp1wAXCedNDmTzNh1VZif2BgxI0XPgrC8/+y4FwL/oBGN
 5d4p0rsJPSz0FT7JgcQBWC55uWoysaOMPTvV3dTSiQ2GxT23p4jb+9BxTtutxaowEwrPIK+VB/ykI
 F+d/cYCJ6F4Iyw==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pnaeW-0007z8-Hk; Sat, 15 Apr 2023 03:48:57 -0400
Date: Sat, 15 Apr 2023 10:48:54 +0300
Message-Id: <83fs91egbd.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <E23597F9-F868-4D04-B814-52B43427DA3D@HIDDEN> (message from
 Yuan Fu on Fri, 14 Apr 2023 13:19:41 -0700)
Subject: Re: bug#62825: 29.0.90; c-ts-mode doesn't recognize DEFUN functions
References: <831qkngdyx.fsf@HIDDEN> <83v8hzeyox.fsf@HIDDEN>
 <E23597F9-F868-4D04-B814-52B43427DA3D@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62825
Cc: 62825 <at> debbugs.gnu.org, theo@HIDDEN
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: -3.3 (---)

> From: Yuan Fu <casouri@HIDDEN>
> Date: Fri, 14 Apr 2023 13:19:41 -0700
> Cc: Theodor Thornhill <theo@HIDDEN>,
>  62825 <at> debbugs.gnu.org
> 
> Ok, I fixed indent-defund and add-log. Because a DEFUN is made of two nodes in the parse tree rather than one, it’s a bit hard to incorporate it into the normal treesit-defun-at-point, etc, functions. And we probably have to fix DEFUN case-by-case.

Thanks.  But I wonder why do we need the c-ts-mode-emacs-devel knob.
Why not recognize DEFUN by default everywhere?  CC Mode does that,
AFAIK, so why shouldn't c-ts-mode do the same?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62825; Package emacs. Full text available.

Message received at 62825 <at> debbugs.gnu.org:


Received: (at 62825) by debbugs.gnu.org; 14 Apr 2023 20:20:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 14 16:20:01 2023
Received: from localhost ([127.0.0.1]:47795 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pnPtp-0001Fj-6W
	for submit <at> debbugs.gnu.org; Fri, 14 Apr 2023 16:20:01 -0400
Received: from mail-pj1-f49.google.com ([209.85.216.49]:52879)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1pnPtn-0001FU-EO
 for 62825 <at> debbugs.gnu.org; Fri, 14 Apr 2023 16:19:59 -0400
Received: by mail-pj1-f49.google.com with SMTP id hg12so5014472pjb.2
 for <62825 <at> debbugs.gnu.org>; Fri, 14 Apr 2023 13:19:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1681503593; x=1684095593;
 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=KbGWXMksJOhUN/i4M8mA0gjy8Ub+UoA9zUWRY/3J3w0=;
 b=KOkvNduR0sZkIOBYlNIk/LJoTDpxkE014Y/a2FZM7Kw6s+6cklPyM4jJ3g3HvmRBhH
 13Tgr4Q9E8cF1476M5D1/dC/PxsK3iG+dgua9DIBjuGXgXMDn8XhUv02A2U0ZTSUzZdf
 4e/GpEsQHuW+MB2F2Uv2trrWqlg0yycDOCu5MBruBbCazdQKczW6Netoewny2arMdgX4
 aIaauNF9WfUcCLfFmfg0YjnQjiDtNHhoDXs6J28k2hrGqZDoM5RBhM8GBTmK9+zS0ixo
 oAca4yeOYgwYO7hRkU0b2q3QI2y4oOOKEV0RzKSBlU7NnoDpEvmIvrC0pBe4gAL5Gmbi
 CYvQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1681503593; x=1684095593;
 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=KbGWXMksJOhUN/i4M8mA0gjy8Ub+UoA9zUWRY/3J3w0=;
 b=Gx2lL+Cx81Rj9nEvEMndxfwxw9bHNMig6oT/DtyaN05krzeOjNnCK7ip7SZybmxyUp
 94opio4IW2Oa8W6+/aj1B/QMJ0JOcMJ7QLfAzG5klRdlbEMiP0luvJLrZrA6IxRPaZtt
 h+AMPkKKS+pYnwSUu2QS3ic9a27nOL9F3RGKSLELHI2UC5HG4jBWe1ugaan6yVP7sKre
 OrZiw0JuZRgTn7zWGFkkVSk6O1vX7aEgC9NvbNqMFGcLAOhjbY79pA0re9Szc3pIFZeH
 fhDk/CBXLnKO67KYdH4KsroDri2lH3BGdu4nbR54JXQLzn/PrTcNmlFEcaxqAdORbzS2
 lXUQ==
X-Gm-Message-State: AAQBX9f07tcEwd+7cdoEs/ti4oM8VKysBO3wr/TBFoTX5MrF+TAfswwC
 PqF4JcIdUT2xk26B5Q0oFnE=
X-Google-Smtp-Source: AKy350a/M0uCkfrLmz4jispHpt26ox2+WRc/u+dCrgT3q4kQc/Qf0lALu5hBgya2XLZCVBzE/1H5YA==
X-Received: by 2002:a17:902:ea03:b0:1a6:8442:545d with SMTP id
 s3-20020a170902ea0300b001a68442545dmr4360392plg.0.1681503593178; 
 Fri, 14 Apr 2023 13:19:53 -0700 (PDT)
Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com.
 [172.117.161.177]) by smtp.gmail.com with ESMTPSA id
 je13-20020a170903264d00b001a50dcd10c8sm3413099plb.277.2023.04.14.13.19.52
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 14 Apr 2023 13:19:52 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.500.231\))
Subject: Re: bug#62825: 29.0.90; c-ts-mode doesn't recognize DEFUN functions
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <83v8hzeyox.fsf@HIDDEN>
Date: Fri, 14 Apr 2023 13:19:41 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <E23597F9-F868-4D04-B814-52B43427DA3D@HIDDEN>
References: <831qkngdyx.fsf@HIDDEN> <83v8hzeyox.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3731.500.231)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62825
Cc: 62825 <at> debbugs.gnu.org, Theodor Thornhill <theo@HIDDEN>
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.0 (-)



> On Apr 13, 2023, at 11:59 PM, Eli Zaretskii <eliz@HIDDEN> wrote:
>=20
>> Date: Fri, 14 Apr 2023 09:44:22 +0300
>> From: Eli Zaretskii <eliz@HIDDEN>
>>=20
>> Evaluating '(treesit-defun-at-point)' inside a function defined via
>> the DEFUN macro yields nil, when the buffer is under c-ts-mode.  This
>> gets in the way of significant functionalities, like
>> c-ts-mode-indent-defun and generating ChangeLog-style log entries
>> using "C-x 4 a" and the likes.
>>=20
>> To reproduce, visit any of the Emacs C source files, like treesit.c,
>> with c-ts-mode, move point to a function defined via DEFUN, and type
>> "C-x 4 a".  The resulting ChangeLog entry will have the file name, =
but
>> not the expected function name in parentheses.
>>=20
>> Please fix this ASAP, this is a bad regression for those, like =
myself,
>> who want to use c-ts-mode.
>=20
> Using treesit-explore-mode I see that c-ts-mode regards DEFUN
> functions as a sequence of 2 expression_statement nodes.  Here's the
> tree corresponding to the DEFUN macro call:
>=20
>  (expression_statement
>   (call_expression
>    function:=20
>     (call_expression function: (identifier) <<<<<<<<<<<<<<<<<<<
>      arguments:=20
>       (argument_list (
> (string_literal " ")
> , (identifier) , (identifier) , (number_literal) , (number_literal) ,
>      (number_literal)
> , (identifier)
> (ERROR :)
> (comment) )))
>    arguments:=20
>     (argument_list ( (identifier)
>      (ERROR (identifier))
>      , (identifier)
>      (ERROR (identifier))
>      )))
>   ;)
>=20
> The identifier node on the line indicated with "<<<<<" is "DEFUN", so
> maybe we can recognize this.  The body of the DEFUN is another
> compound_statement node, following the DEFUN's node.

Ok, I fixed indent-defund and add-log. Because a DEFUN is made of two =
nodes in the parse tree rather than one, it=E2=80=99s a bit hard to =
incorporate it into the normal treesit-defun-at-point, etc, functions. =
And we probably have to fix DEFUN case-by-case.

Yuan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62825; Package emacs. Full text available.

Message received at 62825 <at> debbugs.gnu.org:


Received: (at 62825) by debbugs.gnu.org; 14 Apr 2023 06:59:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 14 02:59:54 2023
Received: from localhost ([127.0.0.1]:45328 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pnDPW-0003FA-JV
	for submit <at> debbugs.gnu.org; Fri, 14 Apr 2023 02:59:54 -0400
Received: from eggs.gnu.org ([209.51.188.92]:40486)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pnDPU-0003Ew-FK
 for 62825 <at> debbugs.gnu.org; Fri, 14 Apr 2023 02:59:53 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pnDPN-0005gK-9J; Fri, 14 Apr 2023 02:59:45 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=sZQ5qa5FHOBkKrYG+YC+3X0dTTFjw7iMTFyvPytaOhw=; b=cvEIrCc5nijI
 t/l9Nr3f/SPmhc3yY8+wbnDDRgGIXiuc8ZrPB+tAhzp+Az0LdyriqK9WPRab3GuhYGWKFhxDDX2+l
 OPOEO0O/+FpckdQg5SUP4lhjxfogvkr58m1es8QXmUJ2o55hf81LRk4GyD58wj95eJbmJ3E8SsUfP
 xSWbtU1aHCDMgOcen+CvMWY6VhBh4z3d+PRqAPRnzfS6S5bMBI/ZaBeov1OFbNkmYGfevbIipAeE6
 XODhf7q8rNJ+Rksszjyfd/Rj6/wFNrPvx1sxVObsYUyl1ukSDvowVONcRxNYbgCbMu79mwRlQj4Ny
 309I5gjAY9BXut87V0Acbw==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pnDPM-0003dX-DI; Fri, 14 Apr 2023 02:59:44 -0400
Date: Fri, 14 Apr 2023 09:59:42 +0300
Message-Id: <83v8hzeyox.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>, Theodor Thornhill <theo@HIDDEN>
In-Reply-To: <831qkngdyx.fsf@HIDDEN> (message from Eli Zaretskii on Fri, 14
 Apr 2023 09:44:22 +0300)
Subject: Re: bug#62825: 29.0.90; c-ts-mode doesn't recognize DEFUN functions
References: <831qkngdyx.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62825
Cc: 62825 <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: -3.3 (---)

> Date: Fri, 14 Apr 2023 09:44:22 +0300
> From: Eli Zaretskii <eliz@HIDDEN>
> 
> Evaluating '(treesit-defun-at-point)' inside a function defined via
> the DEFUN macro yields nil, when the buffer is under c-ts-mode.  This
> gets in the way of significant functionalities, like
> c-ts-mode-indent-defun and generating ChangeLog-style log entries
> using "C-x 4 a" and the likes.
> 
> To reproduce, visit any of the Emacs C source files, like treesit.c,
> with c-ts-mode, move point to a function defined via DEFUN, and type
> "C-x 4 a".  The resulting ChangeLog entry will have the file name, but
> not the expected function name in parentheses.
> 
> Please fix this ASAP, this is a bad regression for those, like myself,
> who want to use c-ts-mode.

Using treesit-explore-mode I see that c-ts-mode regards DEFUN
functions as a sequence of 2 expression_statement nodes.  Here's the
tree corresponding to the DEFUN macro call:

  (expression_statement
   (call_expression
    function: 
     (call_expression function: (identifier) <<<<<<<<<<<<<<<<<<<
      arguments: 
       (argument_list (
	(string_literal " ")
	, (identifier) , (identifier) , (number_literal) , (number_literal) ,
		      (number_literal)
	, (identifier)
	(ERROR :)
	(comment) )))
    arguments: 
     (argument_list ( (identifier)
      (ERROR (identifier))
      , (identifier)
      (ERROR (identifier))
      )))
   ;)

The identifier node on the line indicated with "<<<<<" is "DEFUN", so
maybe we can recognize this.  The body of the DEFUN is another
compound_statement node, following the DEFUN's node.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#62825; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 Apr 2023 06:44:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 14 02:44:33 2023
Received: from localhost ([127.0.0.1]:45296 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pnDAb-0002e5-Mw
	for submit <at> debbugs.gnu.org; Fri, 14 Apr 2023 02:44:33 -0400
Received: from lists.gnu.org ([209.51.188.17]:41294)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pnDAZ-0002dx-25
 for submit <at> debbugs.gnu.org; Fri, 14 Apr 2023 02:44:27 -0400
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 <eliz@HIDDEN>) id 1pnDAY-0006nR-JW
 for bug-gnu-emacs@HIDDEN; Fri, 14 Apr 2023 02:44:26 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1pnDAY-0002ZS-AH
 for bug-gnu-emacs@HIDDEN; Fri, 14 Apr 2023 02:44:26 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=Subject:To:From:Date:mime-version:in-reply-to:
 references; bh=P2/1BX0kviywYOuN/cFc5HU6LNJ2cV2CHuwz+GFXubA=; b=Xf0Kb5Gmem+Xz4
 o7hNrKZrPINYlK0qpcCEc6m80By+QaGfRTU53TBjbUorrKdNNg4GwEUxldhzg4ugkTCrSCNCEeCqO
 VISzMAQXaViUofu1OeeeU9eW1V5d/vZ4s6Rk4BNxYKbJWk1PS/Y2UOtX4aceJCN3hm3yRiZZQ0/DW
 ifXd95JyXM05lC0aXQsTJXQqzENCr2+FTDXOoI2CyY4phlum58/Y6mgTXuSFH0ACBMHcb6+wSVAQP
 YxfqOyhlVzF+VprT7Mo9ZbPbtUS4Qts7UJJhqVn1upBjVqFf3dLPnFeaf7NoHgWK/+pKWLz0YsABy
 ARiQ+qVHmzXCbgCiJ82A==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1pnDAX-0007Te-Fw
 for bug-gnu-emacs@HIDDEN; Fri, 14 Apr 2023 02:44:25 -0400
Date: Fri, 14 Apr 2023 09:44:22 +0300
Message-Id: <831qkngdyx.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.0.90; c-ts-mode doesn't recognize DEFUN functions
X-Spam-Score: -2.3 (--)
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: -3.3 (---)

Evaluating '(treesit-defun-at-point)' inside a function defined via
the DEFUN macro yields nil, when the buffer is under c-ts-mode.  This
gets in the way of significant functionalities, like
c-ts-mode-indent-defun and generating ChangeLog-style log entries
using "C-x 4 a" and the likes.

To reproduce, visit any of the Emacs C source files, like treesit.c,
with c-ts-mode, move point to a function defined via DEFUN, and type
"C-x 4 a".  The resulting ChangeLog entry will have the file name, but
not the expected function name in parentheses.

Please fix this ASAP, this is a bad regression for those, like myself,
who want to use c-ts-mode.

In GNU Emacs 29.0.90 (build 2, i686-pc-mingw32) of 2023-04-10 built on
 HOME-C4E4A596F7
Windowing system distributor 'Microsoft Corp.', version 5.1.2600
System Description: Microsoft Windows XP Service Pack 3 (v5.1.0.2600)

Configured using:
 'configure --prefix=/d/usr --with-wide-int --with-native-compilation
 'CFLAGS=-O2 -gdwarf-4 -g3''

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp1255

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
comp comp-cstr warnings icons subr-x rx cl-seq cl-macs gv cl-extra
help-mode bytecomp byte-compile cl-lib sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win
w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads w32notify w32 lcms2 multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 83196 14093)
 (symbols 48 8277 0)
 (strings 16 22852 2978)
 (string-bytes 1 598231)
 (vectors 16 16223)
 (vector-slots 8 320282 14191)
 (floats 8 30 46)
 (intervals 40 293 0)
 (buffers 888 12))




Acknowledgement sent to Eli Zaretskii <eliz@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#62825; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 16 Apr 2023 08:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.