all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Joakim Jalap <joakim.jalap@fastmail.com>
To: Edward Hart <edward.dan.hart@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Imenu for cobol-mode
Date: Tue, 07 Mar 2017 21:18:54 +0100	[thread overview]
Message-ID: <87h934kfgx.fsf@fastmail.com> (raw)
In-Reply-To: <CANV9pvvY88dHCgGO0KUQ-Zd6egx_wp6WtE8uMWOvfxBcSt8C+g@mail.gmail.com> (Edward Hart's message of "Sun, 5 Mar 2017 20:13:47 +0000")

[-- Attachment #1: Type: text/plain, Size: 2099 bytes --]

Edward Hart <edward.dan.hart@gmail.com> 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


[-- Attachment #2: version 2 --]
[-- Type: application/emacs-lisp, Size: 8146 bytes --]

  parent reply	other threads:[~2017-03-07 20:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03 18:24 Imenu for cobol-mode Joakim Jalap
2017-03-05 20:13 ` Edward Hart
2017-03-06  8:58   ` Joakim Jalap
2017-03-06 23:27     ` Edward Hart
2017-03-07 20:18   ` Joakim Jalap [this message]
2017-03-15 19:35     ` Joakim Jalap
2017-03-15 21:14       ` Edward Hart
2017-03-16  7:56         ` Joakim Jalap
2017-03-16 12:28           ` Noam Postavsky
2017-03-17 22:47         ` Joakim Jalap
2017-03-26 17:27           ` Joakim Jalap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h934kfgx.fsf@fastmail.com \
    --to=joakim.jalap@fastmail.com \
    --cc=edward.dan.hart@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.