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.


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/).  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:

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 secure email.