[Top][All Lists]

[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: Sun, 5 Mar 2017 20:13:47 +0000

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


On 3 March 2017 at 18:24, Joakim Jalap <address@hidden> wrote:
Hello Emacs Devs and Edward!

Here is my attempt at adding imenu functionality to cobol-mode.

I have tried it on a bunch of programs from the gnu cobol contrib repo, and IMHO
it seems to work pretty well :)

I've noticed one false positive; in the case of a procedure division header
which looks like this:

procedure division chaining input-file-name output-file-name

"change" will wrongly be recognized as a paragraph (is that what it is called?),
ie a function. I guess that could be worked around by making the regexp I use to
search for the procedure division match everything including the ending "."...
Well, that's for another day. I've also only tried this on complete programs, so
I'm not exactly sure how it reacts to a half finished buffer, but I think it
should be allright.

I would be glad if somebody who is a cobol programmer could give it a try and
provide some feedback (I know only of one cobol programmer who uses Emacs so I
cc:d him :))

To try it, eval the attached file (you must load cobol-mode first), visit a
buffer in cobol mode and eval:
 (setq-local imenu-create-index-function 'cobol--imenu-create-index)
 (imenu-add-to-menubar "Imenu"))

then browse away.

Looking forward to your feedback :)

-- Joakim

reply via email to

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