From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Joakim Jalap Newsgroups: gmane.emacs.devel Subject: Re: Imenu for cobol-mode Date: Mon, 06 Mar 2017 09:58:49 +0100 Message-ID: <8760jmlr1y.fsf@fastmail.com> References: <87a892kym7.fsf@fastmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1488790786 31736 195.159.176.226 (6 Mar 2017 08:59:46 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 6 Mar 2017 08:59:46 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (berkeley-unix) Cc: emacs-devel@gnu.org To: Edward Hart Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 06 09:59:36 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ckoUL-0006kq-T9 for ged-emacs-devel@m.gmane.org; Mon, 06 Mar 2017 09:59:30 +0100 Original-Received: from localhost ([::1]:42470 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckoUS-00065y-5D for ged-emacs-devel@m.gmane.org; Mon, 06 Mar 2017 03:59:36 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckoTq-00064l-GM for emacs-devel@gnu.org; Mon, 06 Mar 2017 03:58:59 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ckoTl-0004l3-KO for emacs-devel@gnu.org; Mon, 06 Mar 2017 03:58:58 -0500 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:43545) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ckoTl-0004kz-CM for emacs-devel@gnu.org; Mon, 06 Mar 2017 03:58:53 -0500 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id C2B9A207E6; Mon, 6 Mar 2017 03:58:51 -0500 (EST) Original-Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Mon, 06 Mar 2017 03:58:51 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=8E9ehrW9KgbrhnD70bfcBc0yzno=; b=MOtQKm PlLaPTpWMHkKMdV9tG0UtmUgmh9X4AfCRReeevN62Moevwo/0Gl0KBZRm5ApkO9r +67UYJ29zisbiLMXlQInyBsTE9+YFI9hMzwiIx4h4T8FL68HwqCBSTTafbl0uqxG zd+FlnSgnTfAZ2JkbiwDMJhSV/sZLOcoyNU8Y= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=8E9ehrW9Kgbrhn D70bfcBc0yzno=; b=lNx4YxhB+nomnKiCHhTC+A6mRkZgqeJ9EufcuYD446wxDB FjoVHbWKcgueSqRgWIYgpNkpZszB8JR0do5sGBpQa9LWm44lbtbKgiv+DCodhKZV U8NYQs3BuoVSfufpfpDy0LCSQlN/2F73jDo2SFd75RU3izpdyjw+OVCLOeVOM= X-ME-Sender: X-Sasl-enc: DEZ9TNCdkBOr5EP90srFsgxBfUZac24u8AKN0r+R5efu 1488790731 Original-Received: from genserv (unknown [5.150.202.248]) by mail.messagingengine.com (Postfix) with ESMTPA id 328F17E526; Mon, 6 Mar 2017 03:58:51 -0500 (EST) In-Reply-To: (Edward Hart's message of "Sun, 5 Mar 2017 20:13:47 +0000") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:212794 Archived-At: Edward Hart writes: > Hi Joakim, Hi! > The Imenu functionality is excellent and I can't wait to get it committed. Great :) > 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. That was actually intentional, or well, semi intentional anyway ;) I was debating (with myself) what would look best, I had some idea that the first program/function definition in the file would be the "main" one and that that should get the "main" menu items. But I will change it so that all subprograms are under their respective names. Maybe also put the subprogram submenu first? > 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. Will do! > * 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). Huh, I had no idea that header was optional :) I will change it to cobol--function-id-name-re (I actually meant to use the already defined regexps all along, but I got slightly lost in the maze of all regexps :)) > * The "^[ \t]*\\([[:digit:]]\\{1,2\\}\\|[fsr]d\\)[ \t]+\\(\\w+\\)" regexp can be replaced with cobol--generic-declaration-re. Likewise. > 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 don't really understand what you mean here. Isn't jumping to definitions what Imenu does? :) Or do you mean something more xref-like? Does xref have a generic imenu backend? Should it? Actually I think that peeking should be a feature of xref (xref-peek?). It sounds a bit like xref-show-location-at-point, but maybe not really? Anyway, I think that these things are maybe better left to a xref-backend for cobol-mode (which I would love to write :)). In general I'm quite excited at the prospect of having uniform keybindings and interfaces across modes for things like go to definition (and peek at definition). Come to think of it, ctags already support COBOL, so you should be able to get xref functionality via that, I think. > Regards, > Edward Thanks for the feedback! I will try to have a new version ready before the end of the week. -- Joakim