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: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#78612: closed (imenu list generation failing on some items of
 similar quality)
Date: Fri, 30 May 2025 07:10:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Fri, 30 May 2025 10:09:04 +0300
with message-id <86sekmtw1b.fsf <at> gnu.org>
and subject line Re: bug#78612: imenu list generation failing on some items of similar quality
has caused the debbugs.gnu.org bug report #78612,
regarding imenu list generation failing on some items of similar quality
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
78612: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78612
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: mdnorton <mdnorton <at> proton.me>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: imenu list generation failing on some items of similar quality
Date: Tue, 27 May 2025 17:54:05 +0000
[Message part 3 (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 4 (text/html, inline)]
[Message part 5 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: mdnorton <mdnorton <at> proton.me>
Cc: 78612-done <at> debbugs.gnu.org
Subject: Re: bug#78612: imenu list generation failing on some items of similar
 quality
Date: Fri, 30 May 2025 10:09:04 +0300
> Date: Thu, 29 May 2025 17:57:17 +0000
> From: mdnorton <mdnorton <at> proton.me>
> Cc: 78612 <at> debbugs.gnu.org
> 
> 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.


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.