Hi Joakim,
The Imenu functionality is excellent and I can't wait to get it committed.
I've only found one bug in the patch which involves function definitions and program definitions in the same file. If I create an index for such a file, the index entries for the first program/function are not listed under the program/function's name but just "File section", "Working-storage section", etc. The entries for the following programs/functions are listed under their names, as expected.
I have a few suggestions for the code itself:
- By convention, COBOL keywords are written in uppercase and I think the regexps should be changed to reflect that.
- The code assumes all programs have IDENTIFICATION DIVISION headers, however the header is optional. Match against PROGRAM/FUNCTION-ID instead using cobol--function-id-name-re instead (which is equivalent to cobol--imenu-program-name).
- The "^[ \t]*\\([[:digit:]]\\{1,2\\}\\|[fsr]d\\)[ \t]+\\(\\w+\\)" regexp can be replaced with cobol--generic-declaration-re.
Two very useful features I'd like to suggest would be peeking at (displaying the line a data item is defined on in a temporary buffer would be good enough) and jumping to data definitions. Adding key bindings for them would be an added bonus.
Regards,
Edward