[Top][All Lists]

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

Imenu for cobol-mode

From: Joakim Jalap
Subject: Imenu for cobol-mode
Date: Fri, 03 Mar 2017 19:24:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (berkeley-unix)

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

Attachment: cobol-mode-imenu.el
Description: cobol-mode-imenu

reply via email to

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