emacs-devel
[Top][All Lists]
Advanced

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

Re: Imenu for cobol-mode


From: Edward Hart
Subject: Re: Imenu for cobol-mode
Date: Wed, 15 Mar 2017 21:14:53 +0000

HI Joakim,

Sorry for not getting back to you sooner (my problem sheets have become quite difficult this term).

The peek and goto features work very well. I also appreciate the extra code comments.

So now the procedure division itself gets an entry under "PROCEDURE DIVISION" or "$subprogram_name PD" with the name of the subprogram/function. WDYT?

I think "PD header" would be a good name.

I noticed you added (require 'seq) to the file. What do you use the library for? It would be nice to avoid having dependencies.

I've found one extra bug: the functions don't index index-names. Their declaration is of the form "INDEXED \\(BY\\)? (\w+)". It won't be possible to merge it with the generic declaration regexp, since the INDEXED clause often appears at the ends of lines, within another item's declaration.

Edward


On 15 March 2017 at 19:35, Joakim Jalap <address@hidden> wrote:
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]