From: "e190@163.com" <e190@163.com>
To: casouri <casouri@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, 60296 <60296@debbugs.gnu.org>
Subject: bug#60296: Re: bug#60296: The imenu is not created properly in c-ts-mode
Date: Tue, 27 Dec 2022 18:03:14 +0800 [thread overview]
Message-ID: <2022122718031367030419@163.com> (raw)
In-Reply-To: <202212241731446537597@163.com>
[-- Attachment #1: Type: text/plain, Size: 4119 bytes --]
>> On Dec 25, 2022, at 11:58 PM, e190@163.com wrote:
>>
>> >> On Dec 24, 2022, at 10:53 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> >>
>> >>> Cc: 60296-done@debbugs.gnu.org
>> >>> From: Yuan Fu <casouri@gmail.com>
>> >>> Date: Sat, 24 Dec 2022 19:00:21 -0800
>> >>>
>> >>>> From: sniper <e190@163.com>
>> >>>> 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.
>>
>> >My bad. I’ve fixed that by changing args to _.
>> Hi, Yuan:
>>
>> I tested it in the latest version and found several more issues.
>> ``` c
>> int main(int argc, char *argv[])
>> {
>> .....
>> struct name_t name = (struct name_t)name;
>> name.a = 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.
>>
>>
>> ``` 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.
Hi, Yuan:
I found another problem, this problem can not be easy to solve.
```
int func_1(int v) { if(v == 0){ } #ifdef MMM else if(v == 1){ } #endif return v; }
```
A function like this has macros in it.
The imenu created looks like this
```
+ Function main + func_1 func_1 if
```
Thanks.
e190@163.com
From: Yuan Fu
Date: 2022-12-26 17:47
To: e190
CC: Eli Zaretskii; 60296
Subject: Re: bug#60296: The imenu is not created properly in c-ts-mode
> On Dec 25, 2022, at 11:58 PM, e190@163.com wrote:
>
> >> On Dec 24, 2022, at 10:53 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> >>
> >>> Cc: 60296-done@debbugs.gnu.org
> >>> From: Yuan Fu <casouri@gmail.com>
> >>> Date: Sat, 24 Dec 2022 19:00:21 -0800
> >>>
> >>>> From: sniper <e190@163.com>
> >>>> 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.
>
> >My bad. I’ve fixed that by changing args to _.
> Hi, Yuan:
>
> I tested it in the latest version and found several more issues.
> ``` c
> int main(int argc, char *argv[])
> {
> .....
> struct name_t name = (struct name_t)name;
> name.a = 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.
>
>
> ``` 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
[-- Attachment #2: Type: text/html, Size: 9470 bytes --]
prev parent reply other threads:[~2022-12-27 10:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-24 9:31 bug#60296: The imenu is not created properly in c-ts-mode e190
2022-12-25 3:00 ` Yuan Fu
2022-12-25 6:53 ` Eli Zaretskii
2022-12-25 8:31 ` Yuan Fu
2022-12-26 7:58 ` bug#60296: " e190
2022-12-26 9:47 ` Yuan Fu
2022-12-27 10:03 ` e190 [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2022122718031367030419@163.com \
--to=e190@163.com \
--cc=60296@debbugs.gnu.org \
--cc=casouri@gmail.com \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).