I want to use imenu in matlab-mode
in emacs. So I add something like
(setq imenu-generic-expression
'(("Function"
"\\(function\\)[\n\t ]*\\[?[ ,_A-Za-z0-9]+\\]?[\n\t ]*=[\n\t ]*\\([_A-Za-z0-9]+\\)" 2)
("Anonymous Function"
"\\([_A-Za-z0-9]+\\)[\n\t ]*=[\n\t ]*@[\n\t ]*([, _A-Za-z0-9]+)" 1)))
in a function for matlab-mode-hook
.
The matlab function definitions are something like
function y = func1 (x)
end
function [y, z] = func2 (a, b, c)
end
func3 = @(x) sin(x) + cos(x);
The above config results in something like
Function / func1
Function / func2
Anonymous Funtion / 3
after the helm-semantic-or-imenu
or ido-imenu
commands are launched.
My question is why the regular expression for anonymous function did not capture the function name fun3
as expected but 3
?
Any help will be appreciated.
\_<
.