GNU bug report logs - #60296
The imenu is not created properly in c-ts-mode

Previous Next

Package: emacs;

Reported by: "e190 <at> 163.com" <e190 <at> 163.com>

Date: Sat, 24 Dec 2022 09:33:02 UTC

Severity: normal

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: "e190 <at> 163.com" <e190 <at> 163.com>
To: casouri <casouri <at> gmail.com>,  "Eli Zaretskii" <eliz <at> gnu.org>
Cc: 60296 <60296 <at> debbugs.gnu.org>
Subject: bug#60296: Re: bug#60296: The imenu is not created properly in c-ts-mode
Date: Mon, 26 Dec 2022 15:58:47 +0800
[Message part 1 (text/plain, inline)]
>> On Dec 24, 2022, at 10:53 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>>
>>> Cc: 60296-done <at> debbugs.gnu.org
>>> From: Yuan Fu <casouri <at> gmail.com>
>>> Date: Sat, 24 Dec 2022 19:00:21 -0800
>>>
>>>> From: sniper <e190 <at> 163.com>
>>>> To: bug-gnu-emacs <at> 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.



e190 <at> 163.com
 
From: Yuan Fu
Date: 2022-12-25 16:31
To: Eli Zaretskii
CC: 60296; e190
Subject: Re: bug#60296: The imenu is not created properly in c-ts-mode
 
 
> On Dec 24, 2022, at 10:53 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> Cc: 60296-done <at> debbugs.gnu.org
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Sat, 24 Dec 2022 19:00:21 -0800
>> 
>>> From: sniper <e190 <at> 163.com>
>>> To: bug-gnu-emacs <at> 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 _.
 
Yuan
[Message part 2 (text/html, inline)]

This bug report was last modified 2 years and 148 days ago.

Previous Next


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