emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Imenu for cobol-mode


From: Joakim Jalap
Subject: Re: Imenu for cobol-mode
Date: Wed, 15 Mar 2017 20:35:22 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (berkeley-unix)

Joakim Jalap <address@hidden> writes:

I will humbly ping this while I still have it relatively fresh in my
mind :)
Has anybody had a chance to look at this?

> Edward Hart <address@hidden> writes:
>
>> Hi Joakim,
>>
>> 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 now changed it so that if there is only one subprogram the menu
> items are the full "WORKING-STORAGE SECTION", "FILE SECTION" etc, but if
> there is more than one every subprogram's items are listed under the
> respective subprogram name.
>
>> 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.
>
> Done.
>
>> * 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).
>
> Done.
>
>> * The "^[ \t]*\\([[:digit:]]\\{1,2\\}\\|[fsr]d\\)[ \t]+\\(\\w+\\)"
>> regexp can be replaced with cobol--generic-declaration-re.
>
> And done :)
>
> I discovered another thing I had overlooked: There need not be
> paragraphs (or sections or whatever they're called) in the procedure
> division. Some programs just have the code directly there. So now the
> procedure division itself gets an entry under "PROCEDURE DIVISION" or
> "$subprogram_name PD" with the name of the subprogram/function. WDYT?
>
>> 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.
>
> I took the liberty of hacking up something :) That's the last three
> functions in the file. It's very ugly and I did it mostly to see if it
> could work, and well, it seems to work a little at least.
>
> -- Jocke



reply via email to

[Prev in Thread] Current Thread [Next in Thread]