GNU bug report logs - #15560
24.3.50; [patch] * imenu.el (imenu--generic-function): Don't generate index for comments area.

Previous Next

Package: emacs;

Reported by: William Xu <william.xwl <at> gmail.com>

Date: Tue, 8 Oct 2013 08:18:01 UTC

Severity: minor

Tags: patch

Found in version 24.3.50

Fixed in version 24.4

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15560 in the body.
You can then email your comments to 15560 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#15560; Package emacs. (Tue, 08 Oct 2013 08:18:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to William Xu <william.xwl <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 08 Oct 2013 08:18:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: William Xu <william.xwl <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; [patch] * imenu.el (imenu--generic-function): Don't generate
 index for comments area.
Date: Tue, 8 Oct 2013 16:17:04 +0800
[Message part 1 (text/plain, inline)]
It is annoying when imenu generates index also for functions found in
comments area.  e.g., in c-mode:

/*
a : Modified filesys_init()
  : hello
*/

uint8 filesys_init( void )
    {
    }

imenu will generate two filesys_init, which makes imenu useless.

This patch skips comment area completely.  In this case, it will
generate only one filesys_init.


-William
[Message part 2 (text/html, inline)]
[0001-imenu.el-imenu-generic-function-Don-t-generate-index.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15560; Package emacs. (Tue, 08 Oct 2013 21:59:02 GMT) Full text and rfc822 format available.

Message #8 received at 15560 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: William Xu <william.xwl <at> gmail.com>, 15560 <at> debbugs.gnu.org
Subject: RE: bug#15560: 24.3.50; [patch] * imenu.el (imenu--generic-function):
 Don't generate index for comments area.
Date: Tue, 8 Oct 2013 14:58:04 -0700 (PDT)
> It is annoying when imenu generates index also for functions found
> in comments area.

Yes!  And no.  It depends what you want at the particular time.
Sometimes you have multiple versions of a definition, with all
but one commented out, and you *want* Imenu to present you with
all of them, for easy navigation among them. 

> imenu will generate two filesys_init, which makes imenu useless.

No, not useless - see above.  Sometimes annoying, sometimes useful.

> This patch skips comment area completely.  In this case, it will
> generate only one filesys_init.

It's not great to impose this behavior on users: they lose a feature
that way.  Better to let users choose, and let them toggle the behavior.

(I do that in Imenu+, for instance: the Imenu menu always contains
these additional menu items, which affect Imenu behavior: Toggle
Case-Sensitive Name-Sort, Toggle Ignoring Commented Defs, Toggle
Sorting.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15560; Package emacs. (Wed, 09 Oct 2013 09:22:02 GMT) Full text and rfc822 format available.

Message #11 received at 15560 <at> debbugs.gnu.org (full text, mbox):

From: William Xu <william.xwl <at> gmail.com>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 15560 <at> debbugs.gnu.org
Subject: Re: bug#15560: 24.3.50; [patch] * imenu.el (imenu--generic-function):
 Don't generate index for comments area.
Date: Wed, 9 Oct 2013 17:21:08 +0800
[Message part 1 (text/plain, inline)]
2013/10/9 Drew Adams <drew.adams <at> oracle.com>

    > It is annoying when imenu generates index also for functions found
    > in comments area.

    Yes!  And no.  It depends what you want at the particular time.
    Sometimes you have multiple versions of a definition, with all
    but one commented out, and you *want* Imenu to present you with
    all of them, for easy navigation among them.

In the source codes i'm working with, there are very long change history at
the
beginning of file.  So for me, imenu becomes almost useless.  I'm using
imenu as
a function indexer, like those in modern IDEs, where they usually ignore
commentted defs.


-William
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15560; Package emacs. (Wed, 09 Oct 2013 12:24:01 GMT) Full text and rfc822 format available.

Message #14 received at 15560 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: William Xu <william.xwl <at> gmail.com>
Cc: 15560 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#15560: 24.3.50;
 [patch] * imenu.el (imenu--generic-function): Don't generate index
 for comments area.
Date: Wed, 09 Oct 2013 08:23:17 -0400
> a function indexer, like those in modern IDEs, where they usually ignore
> commentted defs.

While it may be occasionally handy to include code that's in comment,
the default should indeed be to skip comments.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15560; Package emacs. (Wed, 09 Oct 2013 14:32:02 GMT) Full text and rfc822 format available.

Message #17 received at 15560 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: William Xu <william.xwl <at> gmail.com>
Cc: 15560 <at> debbugs.gnu.org
Subject: RE: bug#15560: 24.3.50; [patch] * imenu.el (imenu--generic-function):
 Don't generate index for comments area.
Date: Wed, 9 Oct 2013 07:31:11 -0700 (PDT)
>     > It is annoying when imenu generates index also for functions found
>     > in comments area.
> 
>   Yes!  And no.  It depends what you want at the particular time.
>   ^^^^
>   Sometimes you have multiple versions of a definition, with all
>   but one commented out, and you *want* Imenu to present you with
>   all of them, for easy navigation among them.
> 
> In the source codes i'm working with, there are very long change history at the
> beginning of file.  So for me, imenu becomes almost useless.  I'm using imenu as
> a function indexer, like those in modern IDEs, where they usually ignore
> commentted defs.-William

Did you see my emphatic "Yes!"?

I agree that this is usually the behavior one wants, which is why I
implemented it (years ago), and why I chose ignoring commented definitions
as the default behavior.

My point is that sometimes it can be useful to not ignore commented
definitions, and that users should be the ones to choose the behavior that
is most useful to them.  That's all.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15560; Package emacs. (Wed, 09 Oct 2013 14:32:03 GMT) Full text and rfc822 format available.

Message #20 received at 15560 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>, William Xu
 <william.xwl <at> gmail.com>
Cc: 15560 <at> debbugs.gnu.org
Subject: RE: bug#15560: 24.3.50; [patch] * imenu.el (imenu--generic-function):
 Don't generate index for comments area.
Date: Wed, 9 Oct 2013 07:31:30 -0700 (PDT)
> > a function indexer, like those in modern IDEs, where they usually ignore
> > commentted defs.
> 
> While it may be occasionally handy to include code that's in comment,
> the default should indeed be to skip comments.

Of course.  The point is that it should be a user choice, and one that is
easy to make and unmake.




Reply sent to Dmitry Gutov <dgutov <at> yandex.ru>:
You have taken responsibility. (Sun, 24 Nov 2013 21:30:03 GMT) Full text and rfc822 format available.

Notification sent to William Xu <william.xwl <at> gmail.com>:
bug acknowledged by developer. (Sun, 24 Nov 2013 21:30:05 GMT) Full text and rfc822 format available.

Message #25 received at 15560-done <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: William Xu <william.xwl <at> gmail.com>
Cc: 15560-done <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#15560: 24.3.50;
 [patch] * imenu.el (imenu--generic-function): Don't generate index
 for comments area.
Date: Sun, 24 Nov 2013 23:28:39 +0200
Version: 24.4

William Xu <william.xwl <at> gmail.com> writes:

> 2013/10/9 Drew Adams <drew.adams <at> oracle.com>
>
>> It is annoying when imenu generates index also for functions found
>> in comments area.
>
> Yes! And no. It depends what you want at the particular time.

See new user option `imenu-generic-skip-comments-and-strings', added in
115213.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 23 Dec 2013 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 151 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.