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#60296: The imenu is not created properly in c-ts-mode Date: Mon, 26 Dec 2022 01:47:32 -0800 Message-ID: <876EAEFC-650C-4D0E-BD2A-637F7887C146@gmail.com> References: <202212241731446537597@163.com> <83bkns3rf2.fsf@gnu.org> <5C8629D4-6B5D-4478-83E2-9D4027C0F8C7@gmail.com> <2022122615584707191012@163.com> 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="2701"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 60296 <60296@debbugs.gnu.org> To: e190@163.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 26 10:48:09 2022 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 1p9k5Z-0000Vz-2Z for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 26 Dec 2022 10:48:09 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9k5T-0000kV-D0; Mon, 26 Dec 2022 04:48:03 -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 1p9k5S-0000jr-7P for bug-gnu-emacs@gnu.org; Mon, 26 Dec 2022 04:48:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9k5R-00044S-VW for bug-gnu-emacs@gnu.org; Mon, 26 Dec 2022 04:48:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p9k5R-0000Eb-Kv for bug-gnu-emacs@gnu.org; Mon, 26 Dec 2022 04:48:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 26 Dec 2022 09:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60296 X-GNU-PR-Package: emacs Original-Received: via spool by 60296-submit@debbugs.gnu.org id=B60296.1672048063789 (code B ref 60296); Mon, 26 Dec 2022 09:48:01 +0000 Original-Received: (at 60296) by debbugs.gnu.org; 26 Dec 2022 09:47:43 +0000 Original-Received: from localhost ([127.0.0.1]:50788 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9k59-0000Cd-8M for submit@debbugs.gnu.org; Mon, 26 Dec 2022 04:47:43 -0500 Original-Received: from mail-pl1-f171.google.com ([209.85.214.171]:41535) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9k57-0000Bn-7J for 60296@debbugs.gnu.org; Mon, 26 Dec 2022 04:47:41 -0500 Original-Received: by mail-pl1-f171.google.com with SMTP id jl4so4072563plb.8 for <60296@debbugs.gnu.org>; Mon, 26 Dec 2022 01:47:41 -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=1g9yLj4IA5PXrmBErjc3NDiNTWoyiXfC3lfF45MQ0Wo=; b=HUUf71HBJIObcwbLYZ4rBA8GCNrtlu0oLlM9iv+IGU4cBm/K+D4w36rSNezlRc0vNf 2liuyx6ZA3qxPWg/CmTcO4DqI/btIyp7J43C/4BXoXOrgee+rvD403qHVAfqSHpn6dGg Wzc6hY1fhHozq7DY9iXw4kPx6HXoMTNmu76TlytTU9RM3dxp1lzeRx7ltEpa3yyj5+R4 d+PluPas5nBEReU6m3ia5FecPQx9bax1gp6zyF1n6vCQ+hL6Y5rBVeyhYkX/Zfh+PeuC byOQw7VofqQ1/DmGsNi+z9x4FexdH3xSxeS//6k5vEZTxVhYtuoHgRIMylREuIDMRg+H 7Z2Q== 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=1g9yLj4IA5PXrmBErjc3NDiNTWoyiXfC3lfF45MQ0Wo=; b=3pddGO5i5hprhBjbuGbCm9kylX9DtRg83C83dy+LO/U5cjFGWflB2NeigJCp98TqHR kYH5DQ1PRVGYYgrfZVQ/2ANjtRYmpT7eIkfJHgYRFXbLbA+xEgW7CPPZAWAbyPz1btKe bJXaWReJCzw4eIQTVzaWKCYi4l6zfVjd5ziyw7ZY5TaRmvsIMy6jZzs4urGxzSanm7pU QOJhvjnsC9nm/DuJL7QIqQlqY6A/gxc0rjrfH8HOATMjhULQUiGThnRYOZJU6aGoju7A LYP6LMdsC/bYF0Mjtax28dLyJNmfz73LyP0PpWh2UASnuf5l3zHLbHn45kSeHFUO+6k+ z0OA== X-Gm-Message-State: AFqh2komHcSo1Hil2ALqaTPSGpV6lK1VO7aTuH/0rOVl322rH2wGN2Lh 9noi5urLmUaAA0OsVVvCn+A= X-Google-Smtp-Source: AMrXdXtvB7gNPZJdTQsX9GGDSDAmrFPzD/vYQ88R72dskjgVG3zxM6+b2Iz6pj2qEbghOo/s9I805g== X-Received: by 2002:a05:6a20:3d85:b0:9e:ae77:aad7 with SMTP id s5-20020a056a203d8500b0009eae77aad7mr31324909pzi.29.1672048055256; Mon, 26 Dec 2022 01:47:35 -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 q24-20020a631f58000000b0043c732e1536sm6097148pgm.45.2022.12.26.01.47.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Dec 2022 01:47:34 -0800 (PST) X-Priority: 3 In-Reply-To: <2022122615584707191012@163.com> X-Mailer: Apple Mail (2.3696.120.41.1.1) 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:251893 Archived-At: > On Dec 25, 2022, at 11:58 PM, e190@163.com wrote: >=20 > >> On Dec 24, 2022, at 10:53 PM, Eli Zaretskii wrote: > >> > >>> Cc: 60296-done@debbugs.gnu.org > >>> From: Yuan Fu > >>> Date: Sat, 24 Dec 2022 19:00:21 -0800 > >>> > >>>> From: sniper > >>>> To: bug-gnu-emacs@gnu.org > >>>> Subject: 29.0.60; The imenu is not created properly in c-ts-mode. > >>>> > >>>> ``` c > >>>> char *test(int size){ > >>>> return NULL; > >>>> } > >>>> ``` > >>>> If c-ts-mode is enabled in a c file, the imenu created will be [` = test(int size)`] if the return type of the function is a > >>>> pointer. > >>>> The expected display should just be the function name [` test `], = with no subsequent arguments > >>> > >>> Thanks, this should be fixed now. > >> > >> This change leads to > >> > >> In c-ts-mode--fontify-declarator: > >> progmodes/c-ts-mode.el:405:69: Warning: Unused lexical argument = `args' > >> > >> And "&rest args" is indeed unused there, AFAICT. > =20 > >My bad. I=E2=80=99ve fixed that by changing args to _. > Hi, Yuan: >=20 > I tested it in the latest version and found several more issues. > ``` c > int main(int argc, char *argv[]) > { > ..... > struct name_t name =3D (struct name_t)name; > name.a =3D sizeof(struct name_t); > ..... > } > ``` > If Forced conversion or ` sizeof(struct name_t) ` occurs in a = function, it will occur in the Struct entry of imenu. >=20 >=20 > ``` c > int func_1(int v); // <-- function declaration > int main(int argc, char *argv[]) > { > } > ``` > If there is a function declaration in the c file, it will also appear = in imenu's Variable entry. Thanks, I fixed those. Further more, I improved the whole imenu thing in = c-ts-mode and it should be robust now. Yuan=