GNU bug report logs - #78612
imenu list generation failing on some items of similar quality

Previous Next

Package: emacs;

Reported by: mdnorton <mdnorton <at> proton.me>

Date: Wed, 28 May 2025 01:46:03 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Full log


View this message in rfc822 format

From: mdnorton <mdnorton <at> proton.me>
To: 78612 <at> debbugs.gnu.org
Subject: bug#78612: imenu list generation failing on some items of similar quality
Date: Tue, 27 May 2025 17:54:05 +0000
[Message part 1 (text/plain, inline)]
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.
[Message part 2 (text/html, inline)]

This bug report was last modified 20 days ago.

Previous Next


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