Subject: bug#78612: closed (Re: bug#78612: imenu list generation failing on some items of similar quality)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 30 May 2025 07:10:02 +0000

Your bug report

#78612: imenu list generation failing on some items of similar quality

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
78612: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78612
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#78612: imenu list generation failing on some items of similar quality
From: Eli Zaretskii <[email-masked]>
To: mdnorton <[email-masked]>
Cc: [email-masked]
Date: Fri, 30 May 2025 10:09:04 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> Date: Thu, 29 May 2025 17:57:17 +0000
> From: mdnorton <[email-masked]>
> Cc: [email-masked]
> 
> Yes, the latest version seems to do what is necessary.  That solves the initial issue, and I suppose imenu is just deeply reliant on a good regex for predictable behavior.  Thanks for considering this problem.

Thanks, I'm therefore closing this bug.

Subject: imenu list generation failing on some items of similar quality
From: mdnorton <[email-masked]>
To: "[email-masked]" <[email-masked]>
Date: Tue, 27 May 2025 17:54:05 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Good morning. I've checked the bug archive for imenu​ and did not find anything that seemed related to what I'm seeing, so going to try to report this via the email in 34.3. Hopefully I cover everything necessary in 34.3. I cannot use the report function as I don't have Emacs set up with a mail service.

- Emacs version: 30.1
- GNU Emacs 30.1 (build 2, x86_64-w64-mingw32) of 2025-02-23

- Windows OS

What I'm seeing is a failure in imenu​ to create a correct list for function names using the MATLAB package ([https://github.com/mathworks/Emacs-MATLAB-Mode/](https://github.com/mathworks/Emacs-MATLAB-Mode/issues/42)). I've been working with the current maintainer and I am pretty certain that this is not directly a MATLAB package issue, though I cannot tell if it is an interaction. The regular expression to identify the function name that is the point of the imenu​ list is pretty gnarly but seems to work with the corner cases required for the syntax.

In any event, this is the behavior I see that doesn't make a lot of sense to me. Given a MATLAB file with the following contents:

% -----------------------------------------------
function foobar1(a, b, c)
end

function foobar2(a, b, c)
end

function gen_pulse_avg_lin_data(a, b, c)
end

function gen_pulse_avg_log_data(a, b, c)
end

function gen_beamsharpened_data(a, b, c)
end

function foobar3(a, b, c)end

% --------------------------------------------------------

As presented, imenu​ will fail and only list the last 3 functions. In the following notes, the "real" functions are defined by those that are not "foobar". I needed to create some experimental padding. So:

- If any single character in either of the three "real" function names is deleted, imenu​ will work and list all functions
- If any any single character in either of the three "real" function names is altered to another character, imenu​ will fail and list only the last 3 functions.
- If a character is added to the first of the three real function names, imenu​ will fail and only list the last 3 functions.
- If a character is added to either of the 2nd or 3rd real function names, imenu​ will fail and only list the last 2 functions.

It just so happens that the three gen​ functions have the same number of characters, and so I thought it might be related to imenu-max-item-length​ however that value is set to 60 characters and so I don't think it's relevant. I can't think of any reason why the list creation is so sensitive to the token length here. Playing around with the token length produced results so strange that I cannot even speculate on a bug vector.

In any event, hope this helps. It's a weird one to me.

Best regards,
Mark Norton

Sent with [Proton Mail](https://proton.me/mail/home) secure email.